cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Access the UI components after placement them in the navigation pane

ZS_10383889
10-Marble

Access the UI components after placement them in the navigation pane

Hello all, your help is needed again.

 

I built a new pane using function ProNavigatorpanePHolderAdd(), which adds a layout from resource file as expected.

Q#1: How do I make this pane active immediately, without clicking on the pane tab?

Q#2 Do I need to activate this layout before trying to access UI components?

 

In order to access UI, e.g. close push button from a new pane I do the following:

- define listener class 

class CommitClosePushButtonListener : public uifcDefaultPushButtonListener
{
public:
    CommitClosePushButtonListener() {}
   ~CommitClosePushButtonListener() {}

   void OnActivate(uifcPushButton_ptr handle);
};

- activate it

   ProNavigatorpanePHolderComponentnameGet(pane_name, "CommitCloseBTN",       &component_name);

   uifcPushButton_ptr commitClose = uifcPushButtonFind(layout_name, component_name);

   CommitClosePushButtonListener* commitCloseLis = new CommitClosePushButtonListener();
   commitClose->AddActionListener(commitCloseLis);
   

- define action callback

void CommitClosePushButtonListener::OnActivate(uifcPushButton_ptr handle)
{
   //debug print
   ProTKFprintf(logfile1, "PushButton\n");
}

Q#3: Why on testing this button I don't get the debug print?

 

Many thanks for your answers.  

 

5 REPLIES 5

UPD.

I found bug in my code.

     uifcPushButton_ptr commitClose = uifcPushButtonFind(layout_name, component_name);

should be instead

    uifcPushButton_ptr commitClose = uifcPushButtonFind(current_window_device_name, component_name);

 

I am left with single question:

   Q#1: How do I make this pane active immediately, without clicking on the pane tab?

 

If somebody knows?

Thank you.

 

I do it by async. mapkey. So simply load an async mapkey for the current window the navigator pane is created in.

 

 Another way would be to find the parent component until you get the tabcontainer and tell it to switch to your tab. But I think that would be much more complex and changes in the std. Dialog from Creo are much more likely to affect your Utility in a way that can cause crashes and that kind of stuff. So the easiest way should be to place a mapkey on the mapkey stack.

 

Also there are some config options that can cause different behaviors that you need to think of. You can undock the tree from die Creo standard dialog and this affects your navigator pane, too.

 

Br,

Eike

Eike, thanks a lot. I will look at the mapkey solution. Is it part from OTK?

I would use ProMacroLoad() but there is also one in otk with RunMacro()

 

Br,

Eike

It seems that mapkey is an ugly workaround solution. Is that what is done as the tree pane is loaded as the first tab? Can't believe it.

Announcements


Top Tags