LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Register Control events?

Hallo,

I've discovered that I can connect a control reference to the EventSource
input of the RegisterForEvents function. This event (e.g Button1:MouseUp)
appears as dynamic event in the EventStructure editor. Up to this point it
seems to be possible to dynamically register for control events. But
register another event (e.g Numeric1:ValueChanged) in the Button1:MouseUp
handler fails and LabVIEW tells "Cannot connect different refnum types".

Dynamically register for control events is something I'm desperately
searching for.

1. Is it just an unwanted behaviour that I can connect a control reference
to a RegisterForEvents function or is this the first step to an
undocumented feature.

2. If it is intended behaviour, how can I complete to
register another
event in a handler?

Thank you

Oliver Friedrich
0 Kudos
Message 1 of 2
(2,537 Views)
> I've discovered that I can connect a control reference to the EventSource
> input of the RegisterForEvents function. This event (e.g Button1:MouseUp)
> appears as dynamic event in the EventStructure editor. Up to this point it
> seems to be possible to dynamically register for control events. But
> register another event (e.g Numeric1:ValueChanged) in the Button1:MouseUp
> handler fails and LabVIEW tells "Cannot connect different refnum types".
>
> Dynamically register for control events is something I'm desperately
> searching for.
>
> 1. Is it just an unwanted behaviour that I can connect a control reference
> to a RegisterForEvents function or is this the first step to an
> undocumented feature.
>
> 2. If it is intended behaviour, how can I
complete to register another
> event in a handler?

The register for events lets you specify which object(s) you are
interested in receiving events on. If you have a VI event, you can
register and reregister at various points in your program to specify
which you are currently interested in. If the events is a Boolean
event, then any Boolean will work, but numerics aren't Booleans. If you
define the initial event to take a Control reference, then both Booleans
and Controls can be wired up since both inherit from Control.

Also note that wiring a not-a-refnum will unregister everything meaning
you don't want events for any particular control.

As for whether or not it is unintended or undocumented. It is
definitely intended, and I suspect that it is documented. Also, I'm
pretty sure the examples show how to do this.

Greg McKaskle
0 Kudos
Message 2 of 2
(2,537 Views)