Jump to content

Detecting events for controls in an array


jpdrolet

Recommended Posts

I want to replace the value of a numeric control (inside an array of clusters) with NaN when the user hits Shift-Del. The event structure (LV7) doesn't allow to select controls inside an array. Is that possible?

Otherwise, the solution I see is to display array elements in a separate cluster and copy/replace element as the index changes.

Link to comment
The event structure (LV7) doesn't allow to select controls inside an array. Is that possible?

2754[/snapback]

It's not just the event structure that doesn't allow selection of array elements, but all property/methods applied on array elements fall into this topic.

It it an intended behaviour. Since at designtime you don't know how many elements will be in the array, and at runtime the number or elements can change, you would get problems when wanting to change the property of element that doesn't exist anymore (how would you create an event on the 25th element of an array when your array just hold 20 elements????)

On arrays you can just act on the properties/methods of the element type. not the elements itself. The events (e.g. Value Changed) react on the elements not the types - so not possible for array elements.

Didier

Link to comment
It's not just the event structure that doesn't allow selection of array elements, but all property/methods applied on array elements fall into this topic.

It it an intended behaviour. Since at designtime you don't know how many elements will be in the array, and at runtime the number or elements can change, you would get problems when wanting to change the property of element that doesn't exist anymore (how would you create an event on the 25th element of an array when your array just hold 20 elements????)

On arrays you can just act on the properties/methods of the element type. not the elements itself. The events (e.g. Value Changed) react on the elements not the types - so not possible for array elements.

Didier

2761[/snapback]

But still, there are controls in the array and they could generate UI events. You can type in or click a control even if the array is empty. You can know which element is currently edited (a specific property for that would be convenient) so you could act on this element according to the event..

Link to comment

Actually, it is possible to do what you want to do. It took a bit of creative programming, but I was able to do it. Please see the attached vi.

If you want the change of the value to trigger a value change event for the array, change the propertynode from 'Value' to 'Value (Signaling)'

Just as an aside, would it not be more convenient to just have the user type 'NaN' into the control? That's three key strokes as compared to two and a lot less programming effort.

Cheers, Heiko

Download File:post-1022-1101394372.vi

Link to comment
...

Just as an aside, would it not be more convenient to just have the user type 'NaN' into the control? That's three key strokes as compared to two and a lot less programming effort.

...

2764[/snapback]

Customer wish... :rolleyes:

By the way, it was asked that only Delete would be used but it is already a standard key used to edit the number. That would be confusing...

Thank you very much hfettig :thumbup:

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.