LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

InsertListItem: error number -60

Hello,

I'm working with LabWindows 6.0 and Windows XP.

I need a control to select a comport for rs232 communication. To avoid the selection of invalid portnumbers, I only want to diplay existing ports of the operating system.

It's a simple code:

    int ports;

    for (ports = 1; ports < 33; ports++)
    {
        err = OpenCom (ports, "");
       
        if (err == 0)
        {
            err = InsertListItem (panel, PCOMPORT_RING, -1, "COM", ports); 
        }
    }


The help contents say that InsertListItem () works with ring controls. But I get the following error -60:

'The control passed must be a list control.'

Paradoxically I get the same error message with a listbox...

What's wrong?

Thanks for any help!

Fredrik
0 Kudos
Message 1 of 6
(3,848 Views)
The only idea that comes to me is that 'panel' points to wrong panel: can it be that the button which fires the callback is on a panel (the one pointed to by 'panel' variable in the callback) different from that which holds the ring / listbox control?

Message Edited by Roberto Bozzolo on 12-22-2005 10:22 AM



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 2 of 6
(3,847 Views)
No. Acuatally it's not a variable. I entered the constant name of the panel...
0 Kudos
Message 3 of 6
(3,842 Views)
Ah, so this is the problem: the 'panel' variable in InsertListItem (as in all functions that treat user interface objects) must receive the handle of the panel that the control lies on. This is basically how the user interface is structured: LoadPanel returns a handle to that particular instance of the panel and all subseguent function address an individual control on that instance pointed to by the handle. This permits you to have different instances of a panel and treat them independently from each other.
 
Since the constant name is in effect a macro with an associated integer value, you have no syntax errors in your code, but the function is more likely to return an error since you are pointing to an object that either is different from the one you expect or doesn't exist at all!
 
So if you pass the handle of the panel instead of its constant name, you will solve your problems.


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 4 of 6
(3,840 Views)
Thank you for the fast answers! It works! Smiley Very Happy

Merry Christmas! Two days remaining...

Fredrik
0 Kudos
Message 5 of 6
(3,838 Views)
To you too! Smiley Tongue


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 6
(3,833 Views)