LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to programmatically control a tabcontrol and its child controls

 



How can I do all of the following programmatically:
Make a particular tab the currently shown tab

Change the back ground for the label of a control on that tab

Make that control the active control so the user can edit it.


Here is my setup.  I have about 25 tab pages, each page has about 40 - 60parameters [ numeric controls or ON/ OFF buttons with labels. ]I have a feature where the user can search for a particular control bygiving part of its name.  I use regexes to search among all the labels but thenonce I find matches, I have to highlight the selected control and make it theactive control.  This does not seem to work the way I expect it to.
The specific problem is that..For some weird reason[ or may be a bug] If I click on any tab, instead ofgoingto the other tab, it goes to tab id 16.I have to  click the tab I want to go to a few times.
If I do a SetActiveTabPage and then SetCtrlAttribute for ATTR_LABEL_BGCOLOR andthen SetACtiveCtrl, then I do not see the bg color change.
However if I do a SetActivePanel with the panel handle that became the tab,instead of doing SetActiveTabPage, the highlight appears, but now the Paneltakes up the whole window covering up the tabcontrol and the rest of the tabs.


0 Kudos
Message 1 of 8
(4,775 Views)

It is not easy to understand what's happening without looking at the code: the functions you are using are the correct one so the problem may line in some code that is different from what you want; some hints can possibly help you in understanding what's happening.

 

  • SetActiveTabPage accepts the index of the tab to shown, not its panel handle.
  • Clicking on a tab actually displays the corresponding page without need of any line of code: if you see another page shown it may be some callback that is executing beyond your desire. Try removing any tab control callback, if any, and see that the tab page shows correctly; next execute the function that selects a specific page / control step-by-step (place a breakpoint and use F8 to execute one instruction at a time) checking panel handles and control IDs to verify that they are the correct ones


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(4,761 Views)

Hi Roberto, 

Unfortunately I cannot share the code yet.

I do not see any call backs for the tab control or the panels that were inserted as TabPages.

The Only time a call back function pointer is set, is for the controls that are with in each tab.

 

Thanks

 

performance

0 Kudos
Message 3 of 8
(4,746 Views)

If debugging the function that searches / activates the control you cannot locate the cause of the problem you could try to create a reduced version of your application with only a few tabs / controls and debug it to verify that even in a much smaller application the abnormal behaviour still remains.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 8
(4,737 Views)

hi Roberto,

 I got some time to look at that issue again and it seems that 16 is the magic number.

 When the number of tabs is greater than 16, if i click on any other tab, tabid 16 becomes the active tab instead of the one that i clicked.  I will try to test it with a minimal app and post here if the issue is reproducible.

 

Thanks

performance.

0 Kudos
Message 5 of 8
(4,722 Views)

I made up a very simple example that handles a 21-tabs control but I couldn't observe the behaviour you are seeing neither manually operating on the tab control nor when using  SetActiveTabPage. I am working on a WinXP Pro SP3 box with CVI2009SP1.

Can you try this project and check what's happening?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 6 of 8
(4,716 Views)

Thanks a lot Roberto,

 Although your example did not help me find the bug directly, I built another example with a tab control and dynamically created the panels to insert as tab pages.  Then i found the bug, in the call back for the child controls that go into each of the tab pages, there is a spurious SetActiveTabPage that was passing in the wrong index!!.

Thank you very much!!  

0 Kudos
Message 7 of 8
(4,705 Views)

I'm happy to have helped you in finding your problem!



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 8
(4,696 Views)