LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strategy for resizing tabs

Hello all,
basically the question is, when you have one (or more) panels within tabs,
do they receive EVENT_PANEL_SIZE callbacks when the tab itself is resized ?

The longer version:

I'm just trying to figure out what is the strategy to adopt to resize a tab
with complex content (over which I want full control).

Say on a panel (Pio) I have a lone tab control (PIO_TAB) with multiple
panels inside:

i = CopyTabPage (Pio, PIO_TAB, 0, Pio, PIO_TAB, -1);
GetPanelHandleFromTabPage (Pio, PIO_TAB, i, &Pnl[i]);
SetPanelAttribute(Pnl[i], ATTR_CALLBACK_FUNCTION_POINTER, cbp_TabPanels);

Now Pio has a callback:
int CVICALLBACK cbp_Genepi (int panel, int event, void *callbackData,
int eventData1, int eventData2) {
....
case EVENT_PANEL_SIZE:
GetPanelAttribute(panel, ATTR_WIDTH, &Width);

GetPanelAttribute(panel, ATTR_HEIGHT, &Height);
SetCtrlAttribute(panel, PIO_TAB, ATTR_WIDTH, Width);
SetCtrlAttribute(panel, PIO_TAB, ATTR_HEIGHT, Height);

Now at this point, do I need to loop through all my Pnl[i] and resize
whatever needs to be resized on them or will this trigger a call to
cbp_TabPanels ?
--
Guillaume Dargaud
http://www.gdargaud.net/



0 Kudos
Message 1 of 4
(3,024 Views)
Still about tabs (which I'm rather unfamiliar with):

DeleteTabPage (Pio, PIO_TAB, 0, 1);
SetActiveTabPage(Pio, PIO_TAB, 0);

Seems to leave the tab in a rather undefined state (the selected tab is
indeed the first one, but the content corresponds to the last one).
Inserting
SetActiveTabPage(Pio, PIO_TAB, 1);
between the two above lines produces the correct result.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 2 of 4
(3,016 Views)

Hi,

 

I couldn't reproduce the "rather undefined state" you described in your post. What version of CVI are you using? Could you attach a small sample program that shows this problem?

0 Kudos
Message 3 of 4
(2,995 Views)
Hi Jared,

> Hi, I couldn't reproduce the "rather undefined state" you
> described
> in your post. What version of CVI are you using? Could you attach a small
> sample
> program that shows this problem?

Apparently that bug only shows up on Linux.

The workaround is to loop through all the tabs once:
for (i=0; i<NbTabs; i++) SetActiveTabPage(Pio, PIO_TAB, i);
After that they display properly.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 4 of 4
(2,964 Views)