09-12-2011 04:04 PM
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.
09-12-2011 11:31 PM - edited 09-12-2011 11:32 PM
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.
09-13-2011 05:28 PM
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
09-14-2011 02:11 AM
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.
09-14-2011 07:54 PM
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.
09-15-2011 02:43 AM
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?
09-15-2011 05:48 PM
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!!
09-16-2011 01:48 AM
I'm happy to have helped you in finding your problem!