LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

question to listbox events

Hallo everybody,

I would like to have a listbox by clicking on the left button, a function have to be done. But this doesn't work by using the command EVENT_LEFT_CLICK or EVENT_COMMIT.

What I need:
Clicking on an listbox item on the left listbox, the right listbox should as the case may be dimmed or not dimmed.

thanks
Florian
0 Kudos
Message 1 of 5
(3,402 Views)

Hi Florian,

listboxes respond normally to mouse and keyboard events as any other controls, as you can see for example in \samplses\userint\listdelx project.

You should revise your application and detect if all the callbacks are correctly associated to controls and so on.

 

... or else I didn't understend exactly what you mean by "left and righe listbox": are they actually two different controls?

Message Edited by Roberto Bozzolo on 08-01-2005 10:14 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 5
(3,398 Views)
Good morning Roberto,

ok I will try to explain my problem:

I have two listboxes: Listbox1 and Listbox2

The Callback on Listbox1 is like:
int CVICALLBACK Listbox1_FUNC (........)
{
int sts;

switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (panel, PANEL_LISTBOX1, &sts);
if (sts == 3)
SetCtrlAttribute (panel, PANEL_LISTBOX2, ATTR_DIMMED, 0);
else
SetCtrlAttribute (panel, PANEL_LISTBOX2, ATTR_DIMMED, 1);
}
return 0;
}

Ok, my problem now:
Changes between "dimmed" or "not dimmed" are only made after a DOUBLE_MOUSE_CLICK.
I would like to have changes after one LEFT_CLICK.
Or can the problem be seen in the basic function of an listbox, so that a listbox ist not able to enter in an EVENT_LEFT_CLICK or EVENT_COMMIT

I hope this explanation helps more to understand my problem.
Florian
0 Kudos
Message 3 of 5
(3,397 Views)
In your code you have trapped the EVENT_COMMIT event, that is fired by a double click with the mouse.
You should trap EVENT_LEFT_CLICK instead to get a single mouse click. As you can see in the sample, it might be good to add trap for double click together with single click so that the callback is fired even if the user double clicks on the control.
 
The only way to obtain a EVENT_COMMIT out of a listbox with only one click is to setup the listbox in check mode, but I don't think this suits well with your application.


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 4 of 5
(3,389 Views)
Ok thanks for your help.
0 Kudos
Message 5 of 5
(3,387 Views)