LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with EasyTab_SetTabAttribute

I'm new to working with EasyTab functions.  So far I've been able to get a number of the functions working okay.  However, the EasyTab_SetTabAttribute function is giving me problems. I'm  using CVI 8.1.  Here's a bit of my code:

 

    mainHandle = LoadPanel (0, "main.uir", MAIN)

   
    subHandle = LoadPanel (mainHandle , "sub.uir", SUB);

    tabCtrl = EasyTab_ConvertFromCanvas (mainHandle , MAIN_CANVAS);
    tabPage1 = EasyTab_AddPanels(mainHandle , tabCtrl, 1, subHandle, 0);
   
    EasyTab_SetTabAttribute(mainHandle , tabCtrl, tabPage1,  ATTR_EASY_TAB_LABEL_BG_COLOR, VAL_BLUE );

 

 

The EasyTab_SetTabAttribute seems like it should be very simple, but it's not working (EasyTab_SetAttribute does work though).  I've tried a couple different control attributes all with the same result.  The EasyTab tab label seems to be derived from the Panel Title of the sub.uir file.  Since it is a Panel Title that is being used as a Tab Label, does this cause some issue that I'm missing?

 

Ultimately, I'd like to hide the Tab Labels completely.  I'm not sure if there is an EasyTab attibute for that.  I know there is for a standard set of tabs, but I don't know if this is the case for EasyTabs.

 

Thanks in advance for any assistance.

0 Kudos
Message 1 of 4
(3,230 Views)

Hi byrd01,

there is a basic misunderstanding in your code that can explain the misbehaviour you are observing: EasyTab_AddPanels return value isn't a handle to the tab, it is an error code instead (infact the handle to the tabs are already known and passed to the function -in your case subHandle; moreover, in case you add more than one panel with this function, which of them would have the handle returned by the function? And the others?)

The same is true for EasyTab_ConvertFromCanvas: its return value is an error code, since as it is explained in the instrument help the function does not alter control ID, which remains the one set while creating the panel, that is MAIN_CANVAS in your case.

 

So if you modify your call this way, it should work as expected:

    mainHandle = LoadPanel (0, "main.uir", MAIN)

    subHandle = LoadPanel (mainHandle , "sub.uir", SUB);
    error = EasyTab_ConvertFromCanvas (mainHandle , MAIN_CANVAS);     // Add error checking if desired
    error = EasyTab_AddPanels(mainHandle , MAIN_CANVAS, 1, subHandle, 0);   // Add error checking if desired
    EasyTab_SetTabAttribute(mainHandle , MAIN_CANVAS, subHandle,  ATTR_EASY_TAB_LABEL_BG_COLOR, VAL_BLUE );

 

The tab label actually IS the panel title assigned in the UIR editor. I am not aware of any problem with it.

 

I cannot search for the correct attribute to hide one or all tabs now: I will do it later when coming to the office.

Message Edited by Roberto Bozzolo on 09-24-2009 06:52 AM


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 4
(3,225 Views)

Actually I must correct myself: the return value from EasyTab_ConvertFromCanvas effectively is the control ID of the tab control, but it's true that it is the same as the canvas control ID. Nevertheless you can use it as the tab control ID in following functions, but you should add error checking to prevent the code from using incorrect IDs if this value is <0.

 

To hide the tab you can use EasyTab_SetTabAttribute (,  ,  , ATTR_EASY_TAB_VISIBLE, 0);

 

Have you looked at the tab control example? (<cvisampledir>\userint\custctrl\easytab\tabdemo.cws) There you can test almost all tab attributes and have a sample code for using them.



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 3 of 4
(3,218 Views)

Thanks so much Roberto!  I definitely was getting very wrapped around the axle with respect to the return values and handles.  Everything works great now.  I tried the ATTR_EASY_TAB_VISIBLE attribute earlier, but couldn't get it to work for the same reasons as described above.  Now that I'm all straight, things are moving much more smoothly.  Oh, and I do have some error checking in the code, I just removed it for the purposes of this thread.  I just thought I'd display the main nuts and bolts here.

 

Thanks again!!

 

 

 

0 Kudos
Message 4 of 4
(3,204 Views)