LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetCtrlIndex Causes Library Errors

LabWindows CVI 9.0.1 (375)

Windows XP Pro

 

I am getting Library Function Error (return value == -55(0xffffffc9) The index passed is out range.

 

The code snippet is:

 

/**START**/

GetNumListItems(panelHandle,PANEL_LISTBOX,&ListCount);

 

if(0 != ListCount)

    SetCtrlIndex(panelHandle,PANEL_LISTBOX,(ListCount-1));

 

/**END**/

 

The error occurrs in the SetCtrlIndex function.

 

Also, I see the same error in similar code:

 

/**START**/

GetNumListItems(panelHandle,PANEL_LISTBOX,&TotalCount);

 

GetLabelFromIndex(panelHandle,PANEL_LISTBOX,(TotalCount - 1), LabelBuff);

 

/**END**/

 

The error occurrs in the GetLabelFromIndex function. 

 

The number of list items is greater than zero in both cases.

 

Any Ideas?

 

Rodney

 

 

0 Kudos
Message 1 of 5
(3,543 Views)

Hi Rodney

 

I tried to reproduce this here.

But it works.

Attached you get the project.

Regards
DianaS
0 Kudos
Message 2 of 5
(3,524 Views)

Hi Rodney

 

I tried to reproduce this here.

But it works.

Attached you get the project.

Regards
DianaS
0 Kudos
Message 3 of 5
(3,524 Views)

My project uses a llistbox as a text box to write status information to a user. The updates to the listbox occur randomly. I have a callback function attached to an async timer at 0.2 second to do this:

 

/**START**/

GetNumListItems(panelHandle,PANEL_LISTBOX,&ListCount);

 

if(0 != ListCount)

    SetCtrlIndex(panelHandle,PANEL_LISTBOX,(ListCount-1));

 

/**END**/

 

It does not happen all the time but it happens enough to cause potential problems. Every time the debugger breaks on the library error, I inspect the value of ListCount. The value is always greater than zero. So, when I subtract one, I should have a valid index into the listbox but I still get the Library Function Error (return value == -55(0xffffffc9) The index passed is out range.

 

Rodney

0 Kudos
Message 4 of 5
(3,518 Views)
Can you attach your project to see this behavior here?
Regards
DianaS
0 Kudos
Message 5 of 5
(3,515 Views)