LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab Parent Panels Do Not Receive Focus Events

Hi all,
In LabWindows/CVI  8.0.1, when I use the new build-in tab control, I do not receive focus events when I click on the Tab surface. This means when the panel is partly covered by another panel and I click somewhere on the tab surface, the panel is not activated and remains behind the covering panel. The only way to get the focus is to click on the panels title bar. How can I correct this behavior?
 
To note:
There is already a knowledge base entry on a similar issue for the easytab control (including a solution by changing the easytab.c code). But since LabWindows/CVI  8 there is a build-in Tab control which is (i think) not based on easytab. See http://digital.ni.com/public.nsf/allkb/cd7667c0da0df8e9862570b300733e10 for this knowledge base entry.
 
Any ideas?
 
 
0 Kudos
Message 1 of 6
(3,643 Views)
I tried to reproduce your behaviour with an example, but it works fine on my machine (WinXP SP2, CVI 8.0.1). Could you please post an example?
0 Kudos
Message 2 of 6
(3,623 Views)

I also use WinXP SP2, CVI 8.0.1. Please find attached my sample.

0 Kudos
Message 3 of 6
(3,603 Views)

OK, now I can see the described behaviour. As an event for the TAB-Control is only generated, when you click on the TAB-Headlines, there is also no way to bring the panel to the front programmatically.

The only fast solution I could offer is, placing a Decoration on every Tab-Page, define a Callback for this decoration, and call

SetActivePanel(subpanel2);

in these callbacks.

You could programmatically size the decorations at the start of your application, so that they fill out the whole Tab-Page.

 

I will try to find a better solution, and will post it as soon as I found something.

Hope this helps!

 

0 Kudos
Message 4 of 6
(3,590 Views)

Thanks for your quick response. I understand the fast solution you propose. Nevertheless, any more elegant solution would be very much appreciated.

Thanks again!

0 Kudos
Message 5 of 6
(3,585 Views)
Thanks for reporting this bug. This will be fixed in the 8.1 release (the beta was released about a month ago).
 
There is a workaround that will require you to add a little bit of code. Install a panel callback for the tab panels. In your main function, add the following...
 
 if ((subpanel2 = LoadPanel (mainpanel, "tab_sample.uir", SUBPANEL_2)) < 0)
  return -1;
 GetNumTabPages(subpanel2, SUBPANEL_2_TAB, &numTabPages);
 for (i=0; i<numTabPages; i++)
  {
  GetPanelHandleFromTabPage (subpanel2, SUBPANEL_2_TAB, i, &tabPanel);
  InstallPanelCallback(tabPanel, TabPanelCB, 0);
  }
And the TabPanelCB should do the following....
 
static int CVICALLBACK TabPanelCB (int panel, int event,
 void *callbackData, int eventData1, int eventData2)
{
 int parent;
 switch (event)
 {
  case EVENT_GOT_FOCUS:
   GetPanelAttribute (panel, ATTR_PANEL_PARENT, &parent);
   SetPanelAttribute (parent, ATTR_ZPLANE_POSITION, 0);
   break;
 }
 return 0;
}
 
This should fix the problem, and hopefully there aren't any buggy side effects that occur because of this workaround.
 
Hope this helps,
 
- jared
0 Kudos
Message 6 of 6
(3,566 Views)