LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how register events for hovering over an array

Hello
 
my problem of today:
i want to register event for hovering on an array.
meaning: when the mouse hoover (or click) on top of an array, an event is registered for the specific element clicked on in the array.
 
anyone knows how to do that?
 
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 1 of 14
(3,701 Views)
There are events related to front panel objects called "Mouse Enter" and "Mouse Leave". The first one fires when the mouse enters the objects's "air space" the other fires when it leave. Do some searching, I seem to remember a while ago someone posting a neat set of VIs using these events to create custom help popups.

Oh yes, in terms of identifying an array element, there are also mouse down events and you can check the control selection property to find out what element is selected.

Mike...

Message Edited by mikeporter on 05-11-2007 10:50 AM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 14
(3,684 Views)

No you see that is the problem:

mouse enter and leave work perfectly on the whole array, not on specific elements.

i could not find a way to check which element is selected in case of mouse enter or down.

the only solution i found was to transform my array into a cluster. then the whole thing work. but we come back on the problem of inserting elelments!

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 3 of 14
(3,676 Views)
Use a table control (which is really just a 2D array of strings). The Selection Start property will tell you what cell the cursor is in, which should be the one you clicked on.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 14
(3,666 Views)
Use the "mouse down" event and then calculate the indices from the dimensions of the array elements.
 
You would do something similar to my old example given here:
 
Good luck!
Message 5 of 14
(3,664 Views)

Mike and Altenbach,

thanks for the tips, however in this specific case they dont help me. the thing is for a table all the nessecary properties are obtainable via a property node (as you point out), so i can then figure out how to use it to create an event to a specific element with the mouse.

this is the same with a cluster.

the problem come when we want to use a plain array. in my case i use an array of enums. there is no way (that i see) to address (or get coords) a specific element. this is annoying! i think we should send to NI a proposition for improvement on this topic. i dont see a reason why one cannot get the reference to the elements of an array, like for a cluster.

the only way i found was to use a cluster of those enums. problem: cant insert...at least, if there would be a special mouse button call for event (like right click?) i could then create an event for shifting elements in the cluster.

btw, did i said already: i love this forum! getting adicted...

 

Message Edited by Gabi1 on 05-11-2007 01:38 PM

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 6 of 14
(3,656 Views)
You can certainly get which element of an array was clicked. You can get the coordinates of the click. Then you will need the bounds of the array and how many elements are shown. If you have the index displayed you can get this value with a property node. Now use the bounds and where the click occured to find which visible element was clicked, add the value of the index display and voila.
 
Now, the other part of your question is not possible as far as I know. You can't register an event for a single element of the array. Arrays and clusters are completely different objects. You will need to use an event of the array, then figure out which element to act on in that event case.
 
Maybe if you describe what you want your program to do we can help you figure out a better way to accomplish it.
Message 7 of 14
(3,642 Views)


@Gabi1 wrote:
thanks for the tips, however in this specific case they dont help me. the thing is for a table all the nessecary properties are obtainable via a property node (as you point out), so i can then figure out how to use it to create an event to a specific element with the mouse.
Have you studied the example I quoted? The only thing it uses is the pixel coordinates, together with the cell size (element dimension in your case). I am pretty sure it can be easily adapted for 1D and 2D arrays.
Message 8 of 14
(3,638 Views)
Here's a little example I threw together to get you started. It uses mouse move, so just move the mouse over the array and it will show you what element you're pointing to.
Message 9 of 14
(3,634 Views)
I actually implemented a 2D array click element detection in my old tic tac toe trainer program. I just posted an old copy here:
 
 
I am pretty sure you can adapt it for your purpose. 🙂 Good luck!
 
 
 
Message 10 of 14
(3,624 Views)