Hi,
I'm getting an invalid control ID. The situation is as follows: I have a main panel that is the main parent, on this panel, i have a tab control (consisting of one or more tabs). On each of the tab control there is a panel that i call
baseTabPanel which is a child of
mainPanel. On tab_panel I have one or more child panels which I call
motorGroupPanel, these panel(s) are children of the
baseTabPanel. The code fails on the line in
red (see snippets below), and the error is
"NON-FATAL RUN-TIME ERROR: "motorcontrol_ui.c", line 174, col 5, thread id 0x00000E2C: Library function error (return value == -13 [0xfffffff3]). Invalid control ID"I have double, and triple-checked the control IDs and they are correct, and give the same values when I 'mouse-over' during debug as the values in the .uir file.
Anyways, Here is the code snippets from main and on:
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if(populateUI() < 0)
return -1;
....
}
static int populateUI(void)
{
unsigned int i;
unsigned int numMotorGroups;
static const unsigned char numGroupsPerPage = 8; //number of motorGroups to be displayed on one page
static int mainPanel; //panel that holds everything
return(makeFirstPage(&mainPanel)); //make the first page
...
}
static int makeFirstPage(int *mainPanel)
{
static int baseTabPanel; //panel that resides on each tab
static int motorGroupPanel; //panel that each motor group resides on
struct
{
int height;
int width;
int top;
int left;
}mainPanelAttr;
//load the main Panel that holds everything
if ((*mainPanel = LoadPanel(0, "motorcontrol_ui.uir", MAIN_PANEL)) < 0)
return -1;
//load the base-level panel that resides on each tab
if((baseTabPanel = LoadPanel(*mainPanel, "motorcontrol_ui.uir", TabPANEL)) < 0)
return -1;
//load the panel that holds each motor group
if((motorGroupPanel = LoadPanel(baseTabPanel, "motorcontrol_ui.uir", MtGrpPnl)) < 0)
return -1;
//Get the top, left position and width, height of the main panel to set the child UI components to
GetCtrlAttribute(*mainPanel, MAIN_PANEL, ATTR_LEFT, &mainPanelAttr.left); FAILS HERE GetCtrlAttribute(*mainPanel, MAIN_PANEL, ATTR_TOP, &mainPanelAttr.top);
GetCtrlAttribute(*mainPanel, MAIN_PANEL, ATTR_HEIGHT, &mainPanelAttr.height);
GetCtrlAttribute(*mainPanel, MAIN_PANEL, ATTR_WIDTH, &mainPanelAttr.width);
//Set the Top, left, width and height of base-level panel to the same as the mainPanel
SetCtrlAttribute(baseTabPanel, TabPANEL, ATTR_LEFT, mainPanelAttr.left);
SetCtrlAttribute(baseTabPanel, TabPANEL, ATTR_TOP, mainPanelAttr.top);
SetCtrlAttribute(baseTabPanel, TabPANEL, ATTR_HEIGHT, mainPanelAttr.height);
SetCtrlAttribute(baseTabPanel, TabPANEL, ATTR_WIDTH, mainPanelAttr.width);
//set the Top, left of the motor group panel to the same as the mainPanel
SetCtrlAttribute(motorGroupPanel, MtGrpPnl, ATTR_LEFT, mainPanelAttr.left);
SetCtrlAttribute(motorGroupPanel, MtGrpPnl, ATTR_TOP, mainPanelAttr.top);
//Display the main Panel
DisplayPanel(*mainPanel);
//Display the base-level tab panel
DisplayPanel(baseTabPanel);
//Display the motor group panel
DisplayPanel(motorGroupPanel);
return 0;
}