02-03-2011 03:54 PM
Apologies for dredging up an old thread.
Does anyone have experience doing this kind of stuff in an XControl? The on and off nature of the Facade VI is making things difficult for me.
I have a picture control in the XControl that I click and drag on. Obviously, what I'm trying to do is ignore the Mouse Move events unless I have clicked on the correct part of the image.
In Init I call an event I made called Init Events, where I register for the Mouse Move and set the others to a blank picture reference. This doesn't work. Mouse Move always triggers. I've attached a very simple (relative to my real one) XControl to illustrate.
Any ideas?
Re the attached.
Test.vi is a vi that just has the xcontrol on it. If you put breakpoints in the facade vi you can see it's not working how I want.
02-03-2011 04:18 PM
02-03-2011 04:21 PM - edited 02-03-2011 04:31 PM
@JackDunaway wrote:
@elset191 wrote:
Does anyone have experience doing this kind of stuff in an XControl? The on and off nature of the Facade VI is making things difficult for me.
I don't think so...Though I have been wrong before. Before I just wanted to act on the dynamic event. Now I want to unregister and filter out the registered events. I don't see how this can be done by using an extra reference in this case.
02-04-2011 10:50 AM
After sleeping on it, I was able to come up with a solution. I created an event handler VI (much like Ben's example on the second page).
There were a few considerations to take into account because it is an XControl. In my Facade VI when I call the Event handler, I had to call it dynamically so it wouldn't lock up the facade VI. Also, I had to create a stop event that I fire in the Uninit Ability in order to stop the event handler subvi.
03-20-2013 06:21 PM
what is that bloc i cn't found it on my labview ??
03-20-2013 07:47 PM
Looks like DrawPoint.vi to me, located in the Graphics->Picture Funcitons palette.
06-25-2014 04:04 PM
Great example - thank you!
I just started using dynamic events.
In the example: I know how to create the Ref Constant for Picture (green color). But how does one create the Static ref for Picture (blue color)?
Thanks again for the excellent example - cannot find much like this on NI site.
06-25-2014 04:48 PM
Right click on the green one and select create constant.
Mike...
01-13-2015 04:14 AM - edited 01-13-2015 04:17 AM
Yet another necro for this great nugget.
I first read it years ago and I keep using it - great info. Let's see if I can give kudos a second time.
Today I wondered whether there is a way to tell what ref is registered to an event if you use DER to turn events on and off.
That would be a nice way to check whether the event is currently on or off.
Sure there are other ways to keep track of which events are currently on and off, but sometimes checking if an event was registered for an empty ref would be the most direct way.
Here is what I tried so far:
re-reading this thread 😉
setting "register for events" to read (found no option to do that),
wiring the reference created by "register for events" into a property node (broken wire),
wiring the reference created by "register for events" into a methode node (broken wire),
type cast is possible - but what to cast to?
Does anyone know a way to get the registered references out of the "register for events"-reference?
Best regards
Florian
Edit: Giving kudos to the original post again worked!
01-14-2015 01:28 AM
You can use a cluster to hold all the Event Refnums - see this post:
http://forums.ni.com/t5/LabVIEW/Nugget-of-the-week-Dynamic-event-registration/m-p/1170399#M509947
If you make a Typedef for the cluster, you can give them nice names.