LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid control ID

Hello,

I use the GetCtrlAttribute() to get some parameters of controls.

When the program running, if i change parameters which cause refresh the panel , and for the refreshing to get information

of some controls , or set some control parameters ( using SetCtrlAttribute() ) ,

i get "Invalid control ID" message.

This message isn't for all the controls of the panel but one of them.

How can i fix it ?

Thank you 

0 Kudos
Message 1 of 8
(4,246 Views)

Hi,

 

this is a frequent error with many related posts: did you use the forum search to find suitable answers, e.g. here

0 Kudos
Message 2 of 8
(4,243 Views)

Thank you for response.

I did read some posts but i didn't find any solution for my problem.

How can i get attribute of some controls and other can't ?

They are in the same panel,and i use the same functions.

I'm using CVI/LabWindows 8.1.

Thank you again

0 Kudos
Message 3 of 8
(4,229 Views)

Hi,

 

- Are you using tab panels?

- Also note that not all attributes are available for all controls.

 

For a more specific help it would be useful if you could post the line resulting in an error: what is the attribute you are trying to obtain from what kind of control...

 

Wolfgang 

0 Kudos
Message 4 of 8
(4,220 Views)

I'm using Tab Panels, in the execution tab panel i have another tab panel .

To insert panels as tabs using CANVAS :

 EasyTab_ConvertFromCanvas(gMainWindow.panel, MAINPANEL_CANVAS));
 EasyTab_AddPanels(gMainWindow.panel, MAINPANEL_CANVAS, 1, gMainWindow.executionTab.execution, gMainWindow.setupTab, gMainWindow.profileTab, gMainWindow.customTab, 0);

 

to insert into execution Tab another tab panel with scroll bar :

 InsertPanelAsTabPage (gMainWindow.executionTab.execution,EXECTAB_TAB ,0,gMainWindow.executionTab.iChild);

 GetPanelHandleFromTabPage(gMainWindow.executionTab.execution,EXECTAB_TAB ,0,&gMainWindow.executionTab.iChild);
 SetPanelAttribute(gMainWindow.executionTab.iChild, ATTR_SCROLL_BARS, VAL_VERT_SCROLL_BAR);

 

the attribute which at first time work good but if i try to make some thing that cause call again to the function with those lines i get the Invalid Control ID :

 GetCtrlAttribute (gMainWindow.executionTab.execution, EXECTAB_DECORATION_1, ATTR_TOP,   &iNumberTop);      // Hi coordinate of Decoration_1 

 GetCtrlAttribute (gMainWindow.executionTab.execution, EXECTAB_DECORATION_1, ATTR_LEFT,   &iLeft);    // Left coordinate Decoration_1 

 GetCtrlAttribute (gMainWindow.executionTab.execution, EXECTAB_DECORATION_1, ATTR_WIDTH,  &iWidth);    // Width of Decoration_1

 

If i'm using another decoration i have in the same panel ,it works OK ,but i have some lines i need to set attribute of this decoration.

How it's possible that one control works good and the other not?

hope this will help to give me clue or solution .

Thank you

Meir

 

0 Kudos
Message 5 of 8
(4,186 Views)

Meir,

it seems that you are using both native CVI tab controls and the EasyTab custom control. The last one is still present in CVI but since the native tab control was included in CVI (I seem to remember it was in release 😎 it seems better to me to use that one instead of the EasyTab instrument. Besides it, you are mixing both of them, which could cause unpredictable results as I don't know how much they are reciprocally compatible.

 

In my opinion you should rewrite your application using only built-in tab controls. Additionally, as explained here by jared, you could design your panel directly in the tab controls and only add the scroll bar programmatically. This could dramatically improve UI design speed and simplify a bit the code (and possibly eliminate the rrors you are facing now)



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

Hi ,

Before i'll try to change the program to tabs as you suggest i tried to build a little program which update data from one tab to other.

as you can see in the same tab i can update 'but i can't do this in the other tab.

What am i missing ?

Thank you ,

Meir

 

0 Kudos
Message 7 of 8
(4,065 Views)

Hi Meir,

what we were trying to make you understand is that each tab page actually is a different panel: your Tab 0 and Tab 1 pages have different panel handles!

 

For this reason, your line

    SetCtrlAttribute (panel, TABPANEL_2_STRING, ATTR_LABEL_TEXT, szTemp);

cannot work since 'panel' here is the panel handle of Tab 0 page (the first page in the tab control) while TABPANEL_2_STRING control is on the second page of the tab control (surely you know that 'panel' parameter in a control callback is the handle of the panel the control is on, in your case the first page of the tab control or Tab 0).

 

To have this code work you must do this:

   GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, 1, &tabpanel);
   SetCtrlVal (tabpanel, TABPANEL_2_STRING , szTemp);

 

In case you have not stored the handle of the panel the tab control is on in a global variable like in this sample, you can always retrieve it by calling:

   GetPanelAttribute (panel, ATTR_PANEL_PARENT, &parent);
   GetPanelHandleFromTabPage (parent, PANEL_TAB, 1, &tabpanel);
and so on...



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 8 of 8
(4,050 Views)