09-10-2017 03:53 PM
I am trying to use the GetTreeItemAttribute CVI function and get the check box state information from a tree and store in a array, but the compiler just gives me errors showing
NON-FATAL RUN-TIME ERROR: "Test.c", line 92, col 17, thread id 8188: Function GetTreeItemAttribute: (return value == -10 [0xfffffff6]). The control is not the type expected by the function。
the source code looks like following:
int panelID = 0;
int i;
int Mark_State;
char Flag[MAXNUMBER];
nullChk (InitCVIRTE (0, argv, 0));
errChk (panelID = LoadPanel (0, "test.uir", PANEL));
for (i = 0; i < MAXNUMBER; i ++){
GetTreeItemAttribute (panelID, TABTEST_TREE, i, ATTR_MARK_STATE, &Mark_State);
Flag[i] = Mark_State;
}
If possible, can somebody help me to take a look and see what is wrong with my code?
Thank you
Solved! Go to Solution.
09-11-2017 12:55 AM
Hi,
You named the tree control as TABTEST_TREE. If your tree is in a tab control you need to get panel handle of the tab. Tab pages have their own panel handles. This is the documentation.
Hope this solves your problem.
09-12-2017 07:39 AM
Thank you so much for the help! i didn't realize that TAB will need a different handler. The problem is fixed.