From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cvi.Easy_Tab EVENT_TAB_CHANGED

I need to know how I can changed the tab's color when I change selection tabs. I know the ATTR_EASY_TAB_TAB_COLOR but where do I bind EVENT_TAB_CHANGED?
0 Kudos
Message 1 of 8
(3,342 Views)
If you created the tab control with EasyTab_ConvertFromCanvas, create a callback for the canvas and check for EVENT_TAB_CHANGED there.
0 Kudos
Message 2 of 8
(3,342 Views)
Yes, I just do it , but I do not know how I can recognice each tab. I have a callback "Switch Tab" on CANVAS. switch (event) EVENT_TAB_CHANGED: After I need switch case for the panels because only the tab selected have to be of another color but I am not able to do it. Can you help me? Thanks.
0 Kudos
Message 3 of 8
(3,342 Views)
Use EasyTab_GetAttribute() to read the ATTR_EASY_TAB_ACTIVE_PANEL attribute.
e.g.

int hMainPanel, tabCtrlMain, hActiveTabPanel;
// hMainPanel will be returned by LoadPanel or LoadPanelEx.
// tabCtrlMain will be passed by reference (pointer)
// to EasyTab_ConvertFromCanvas.

// identify which main panel tab is active
EasyTab_GetAttribute (hMainPanel, tabCtrlMain,
ATTR_EASY_TAB_ACTIVE_PANEL, &hActiveTabPanel);

You can then restore all tabs to the default color, then change the hActiveTabPanel to the new color.
Or you can keep track of the previous active tab, change that tab to the default, then change the new tab to the new color. If you have no other reason to save the previous tab, the first way is probably easier. It will be a little sl
ower (depending on how many tabs you have), but the user probably won't notice.
0 Kudos
Message 4 of 8
(3,342 Views)
Taken from easytab.h file:

#define EVENT_TAB_CHANGED 6000 /* eventData1 = panel of newly active tab, eventData2 = panel of previously active tab */

You can use the eventData parameters automatically passed to the function whenever it is called to address the old and new panels and change their attributes.


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 5 of 8
(3,342 Views)
Just to complete my answer, to change the tab background color you must use

EasyTab_SetTabAttribute (panel, control, eventDataX,
ATTR_EASY_TAB_LABEL_BG_COLOR, VAL_GRAY);

use one of the eventDataX parameters to address the correct tab and change the color constant (or use a different color by menas of MakeColor () function or writing directly RGB values) accordint to your needs.


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 6 of 8
(3,342 Views)
Good suggestion Roberto! I don't remember often enough to check to see what's in the eventData parameters.
0 Kudos
Message 7 of 8
(3,342 Views)
Thank you very much ! I just do it and I solved my problem.
0 Kudos
Message 8 of 8
(3,342 Views)