LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

modify a text label in a tab

Lorsque je place un text label dans un tab, je n'arrive pas à modifier sa valeur (setctrlval).
 
Comment faut-il faire svp?
0 Kudos
Message 1 of 8
(5,060 Views)
pardon, c'est un string que je colle sur mon tab
 
précision:
si le string est sur le panel, je peux le modifier par setctrlval
si le string est sur le tab, je ne peux pas le modifier par setctrlval
 
pourquoi?
 
Merci d'avance
0 Kudos
Message 2 of 8
(5,058 Views)

In order to address controls on a tab page you must firstly get the correct handle of the tab page itself, which acts as a child panel of the panel the tab control is in. To obtain that handle you can use GetPanelHandleFromTabPage function, passing the index of the specific page you need to operate on.

Sorry to answer in englsh: I cannot speak french. Smiley Sad I take this opportunity to inform you that a french-speaking board exists inside NI forums: you can find it here.



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 3 of 8
(5,053 Views)
thanks but it still doesn't work:
 
I have no more Exception Message but when I click on the button, nothing appears in my string
 
anyway, that is not very important
 
the point is just that I am a Delphi developer and using tabs is so much easy in Delphi...
 
thanks for the link of the french community
0 Kudos
Message 4 of 8
(5,045 Views)

I never have used Delphi so I cannot compare these two environments... it is also possible that the deeper knowledge in Delphi makes it easier for you to use its instruments than those of other languages Smiley Happy

Just to clarify some concept, prior to version 8 tab controls were implemented in CVI with the EasyTab control which, if more difficult while designing the user interface (some trial-and-error process was needed to accomodate the final aspect of the tab control within the panel) made it clearer that tab pages are in every aspect independent entities (child panels of the panel the tab control was in) .

With that instrument, the process of creating a tab control within a panel was:
1. Create the area where the tab control should appear (converting a canvas or creating from scratch)
2. Loading (child) panels: each of them has its own handle used to address controls on it
3. Adding panels to the tab control

I suppose the new tab control included in CVI8 is an evolution of this procedure, which hides the process of adding panels and simplifies the design of the user interface. In my opinion, nevertheless, it makes more obscure what really are tab panels and how to address controls on them. You always need to consider that a tab page is actually an independent panel and addressing controls on it must be done via its proper handle. Look at this sample callback which you can find in TabExample.prj (which ships with CVI): as you can see, addressing controls to retrieve and write values is preceded by GetPanelHandleFromTabPage function in order to retrieve the correct handle to the tab page panel.

int CVICALLBACK KnobCB (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    double knobValue;
    switch (event)
    {
        case EVENT_VAL_CHANGED:
            GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, PAGE_TWO, &TabPanelHandle);
            GetCtrlVal (TabPanelHandle, TABPANEL_2_NUMERICKNOB, &knobValue);
            SetCtrlVal (TabPanelHandle, TABPANEL_2_NUMERICTANK, knobValue);

            break;
    }
    return 0;
}

 



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
(5,040 Views)

I don't have the new CVI8 tab features but does not the first parameter to the control callback already contain the correct tab/panel handle? That is, assuming the control manipulations are all on the same tab, of course.

JR

0 Kudos
Message 6 of 8
(5,038 Views)

Yes, you're right: in that piece of code retrieving the tab panel handle is redundant (I suppose it has been added to show the usage of that function).

In any case you do need to retrieve the correct handle if you are operating on a panel different from the tab page and you want to display results / retrieve values with controls on the tab control.



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 7 of 8
(5,034 Views)
yes I am operating on a panel different from the tab page
 
I've tried another time with the example you mentioned and it's works now
 
thanks a lot
 
may be you're right about the deeper knowledge, I will try to practice more Labwindows/CVI
 
Regards,
0 Kudos
Message 8 of 8
(5,030 Views)