LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scroll wheel in Listboxes...halfway there can you help

Hello
The sub vi monitors the mouse scroll wheel and updates listbox selected item in consequence. I am trying to unattach the sub-vi from the main. I can make it stop when the caller front window closes, but I'd prefer to stop it when the caller stops. Is there some property that will allow this. I know I can do it with a control, called "Stop" for example, but I'd like less dependency on the caller structure.

The second problem is to spot which of the caller's controls are Listboxes? I've done it in the example by passing references, but I'd prefer to look at all the controls in the caller and pick out the ones that are listboxes.

The program needs Danny Lauwers' toolbox to be found at http://www.hamil
tondesign-consulting.com/ftpfiles/ToolBox%20v1.8.zip

Ideally I'd like to be able to add the Scroll Wheel subVI to a program which has a front panel; it should find out where all the listboxes are and manage the scroll wheel for them; tehn it should depart quietly when the caller returns to its caller. The idea here is that it will need very little additional work to add this facility.


Yours Sincerely
John
0 Kudos
Message 1 of 7
(3,826 Views)
"when the caller front window closes, but I'd prefer to stop it when the caller stops"

A property node configured for "Exec.State" will return "idle" when a Vi stops.

"The second problem is to spot which of the caller's controls are Listboxes?"

In the attached VI I use a method inspired by Jean-Pierre's "save -all" code.

I get a list of all of the FP controls and then use a "to more specific class" to attempt to type cast the refnums as a List box. If no error is returned, the control is a list box.

You could also parse the type descriptor, but that approach is prone to LV upgrade issues.

Both of these ideas are illustrated in the attached.

I hope this helps,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
0 Kudos
Message 2 of 7
(3,826 Views)
Hello
My thanks to Ben for his help. The program now recognizes listboxes and tables all by itself and identifies its caller. Its only interaction is the calling of ScrollWheelStop.vi to stop the loop in the scroll wheel read program.

I cannot get arrays to set the KeyFocus property. Can anyone think of a suitable property to decide that the scroll wheel movement should be applied to "this" array?

The program needs Danny Lauwers' toolbox to be found at http://www.hamiltondesign-consulting.com/ftpfiles/ToolBox%20v1.8.zip

Yours Sincerely
John www.TradersMicro.com
0 Kudos
Message 3 of 7
(3,826 Views)
Hi John,

Have you tried to select the array by setting the �KeyFocus� property for the array to true?

I can�t test the scroll functionality, since I�m missing the �Windows Messages for LabVIEW.dll�.

Best regards,
Philip C.
Applications Engineer
National Instruments
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 4 of 7
(3,826 Views)
When starting the sub-VI get the postition of every control and create 4 arrays. They could be;

X-max
X-min
Y-max
Y-min

take the mouse X postion and wire to the midle input of a coerce with the X-max array wired to the top and X-min array to the bottom.

Repeat this for Y values.

And the two boolean arrays and search for the first true.

This will give you the index of the control the mouse is over IF IT is OVER a CONTROL!

A -1 is not over a control.

See attached jpg.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,826 Views)
Solved!
The following code has been posted on the Example code section.
Yours Sincerely
John www.tradersmicro.com
0 Kudos
Message 6 of 7
(3,827 Views)

John,

Can you please post the Dll Windows Messages for LabVIEW here ?

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 7 of 7
(3,455 Views)