JDave Posted November 30, 2007 Report Share Posted November 30, 2007 Well, I just started peeking into the world of XControls and it does look fun. However, when I tried to use a dynamically registered event -- it just don't work. Has anyone had success with this, or will I just need to restrict my events to static events (since User Events don't work either) ? David Quote Link to comment
Ton Plomp Posted November 30, 2007 Report Share Posted November 30, 2007 QUOTE(JDave @ Nov 29 2007, 06:44 PM) Well, I just started peeking into the world of XControls and it does look fun. However, when I tried to use a dynamically registered event -- it just don't work. Has anyone had success with this, or will I just need to restrict my events to static events (since User Events don't work either) ?David I am using user events, you can see them in my Boolean XControl. Where I create the event registration in the Init ability and destroy them in the Uninit event. I fire events from methods and properties without problems and my facade VI gets triggered by them. However in my latest experience I have issues where I fire them from a callback VI, this doesn't trigger the facade VI. So it shouldn't give you any problems unless you get really fancy. Ton Quote Link to comment
JDave Posted November 30, 2007 Author Report Share Posted November 30, 2007 QUOTE(tcplomp @ Nov 29 2007, 10:49 AM) I am using user events, you can see them in my Boolean XControl. Where I create the event registration in the Init ability and destroy them in the Uninit event.I fire events from methods and properties without problems and my facade VI gets triggered by them. However in my latest I have issues where I fire them from a callback VI, this doesn't trigger the facade VI. So it shouldn't give you any problems unless you get really fancy. Ton Thanks for the clarification Ton. I misunderstood the problem you were having with the callback VIs. Any experience using other dynamic events? (non User-Events) Quote Link to comment
Ton Plomp Posted November 30, 2007 Report Share Posted November 30, 2007 QUOTE(JDave @ Nov 29 2007, 07:53 PM) Thanks for the clarification Ton. I misunderstood the problem you were having with the callback VIs.Any experience using other dynamic events? (non User-Events) No, I've used them in the start-up fase of the Boolean XControl and seen no issues. Ton Quote Link to comment
gb119 Posted November 30, 2007 Report Share Posted November 30, 2007 QUOTE(tcplomp @ Nov 29 2007, 06:49 PM) I am using user events, you can see them in my Boolean XControl. Where I create the event registration in the Init ability and destroy them in the Uninit event.I fire events from methods and properties without problems and my facade VI gets triggered by them. However in my latest I have issues where I fire them from a callback VI, this doesn't trigger the facade VI. So it shouldn't give you any problems unless you get really fancy. Presumably, running a property or method vi 'wakes up' the facade of the XControl because it is likely that some aspect of the appearance will need updating, in which case the facade can catch your user event. Since the XControl doesn't know that the callback vi might want to mess with the facade, it doesn't get woken up. I guess if your callback vi could get a reference to the XControl you could call some random (dummy) property or method after you send the user event to manually 'awaken' the XControl facade... Quote Link to comment
JDave Posted December 4, 2007 Author Report Share Posted December 4, 2007 QUOTE(tcplomp @ Nov 29 2007, 10:59 AM) No, I've used them in the start-up fase of the Boolean XControl and seen no issues.Ton Here is a barebones XControl example. If you look at the Example VI it shows that the static event causes the boolean to toggle, but the dynamic event does not. I tried to register the event in the Init VI, similar to the Boolean XControl, but it didn't work either. The Boolean XControl registers a User Event, not a UI Event. http://lavag.org/old_files/post-1519-1196708092.zip'>Download File:post-1519-1196708092.zip Example is in LV 8.5 Quote Link to comment
Ton Plomp Posted December 4, 2007 Report Share Posted December 4, 2007 I have succesfully edited your XControl to react on dynamic events. I took multiple steps and don't know exactly what is neccesary, but I think it is this: Create space in you state for a Event Registration Refnum (ERR), make sure it is of the correct type In the init VI set some messaging up that let the Facade VI know it needs to initialized In the init routine of the facade VI, put the multicolumn listbox in the ERR Don't forget to destroy the ERR in the uninit VI In order to get this to work I had to remove the example VI from the XControl (why did you add the example to the XControl?) Here's the core code: Download File:post-2399-1196710162.zip Ton Quote Link to comment
JDave Posted December 4, 2007 Author Report Share Posted December 4, 2007 QUOTE(tcplomp @ Dec 3 2007, 11:28 AM) In order to get this to work I had to remove the example VI from the XControl (why did you add the example to the XControl?) Because I'm a newbie at XControls. Thanks for fixing that. I will give it a good study. David Quote Link to comment
Ton Plomp Posted December 4, 2007 Report Share Posted December 4, 2007 QUOTE(JDave @ Dec 3 2007, 08:34 PM) Because I'm a newbie at XControls.Thanks for fixing that. I will give it a good study. David Your question, made me rethink my .Net Problem and I have succesfully solved it. Ton :thumbup: Quote Link to comment
JDave Posted December 6, 2007 Author Report Share Posted December 6, 2007 QUOTE(tcplomp @ Dec 3 2007, 11:52 AM) Your question, made me rethink my .Net Problem and I have succesfully solved it. That's good to hear. Another one question - Has anyone ever registered for events from the containing VI? I want to capture when the Escape Key is pressed, but the XControl doesn't always have focus (so I can't capture it at the XControl level). I haven't been able to successfully register for any events at the VI level. In fact, when I registered for Key Down? on the owning VI in the Exec State Change event (idle->running), it locks the entire UI. Quote Link to comment
JDave Posted December 7, 2007 Author Report Share Posted December 7, 2007 QUOTE(JDave @ Dec 5 2007, 05:01 PM) Has anyone ever registered for events from the containing VI? I want to capture when the Escape Key is pressed, but the XControl doesn't always have focus (so I can't capture it at the XControl level). I haven't been able to successfully register for any events at the VI level. I figured out how to do this. I believe it requires the use of a separate daemon VI to monitor the events. At least it works. When I get some more stuff worked out I will post the code. David Quote Link to comment
Ton Plomp Posted December 19, 2007 Report Share Posted December 19, 2007 QUOTE(tcplomp @ Dec 3 2007, 08:28 PM) In order to get this to work I had to remove the example VI from the XControl (why did you add the example to the XControl?)Here's the core code: Ton Someone asked for an 8.2 version. Here's a 8.0 version: http://lavag.org/old_files/post-2399-1197994584.zip'>Download File:post-2399-1197994584.zip Ton Quote Link to comment
phuzionz Posted December 20, 2007 Report Share Posted December 20, 2007 QUOTE(tcplomp @ Dec 18 2007, 05:16 PM) Someone asked for an 8.2 version.Here's a 8.0 version: http://lavag.org/old_files/post-2399-1197994584.zip'>Download File:post-2399-1197994584.zip Ton Are you sure that the VI is working, when i press the escape button, labview is crashing! Br, Jeroen Quote Link to comment
Ton Plomp Posted December 20, 2007 Report Share Posted December 20, 2007 QUOTE(phuzionz @ Dec 19 2007, 10:03 AM) Are you sure that the VI is working, when i press the escape button, labview is crashing!Br, Jeroen Here's a tested version on LabVIEW 8.0.(1?) that works. Only the dynamic key-down doesn't work. However the dynamic mouse-down works. Ton Quote Link to comment
DaveKielpinski Posted January 6, 2008 Report Share Posted January 6, 2008 QUOTE(tcplomp @ Dec 4 2007, 05:52 AM) Your question, made me rethink my .Net Problem and I have succesfully solved it.Ton :thumbup: Hi Ton, I've run into a similar problem and am having a hard time with it. Could you post about your solution? Thanks, Dave Quote Link to comment
Ton Plomp Posted January 6, 2008 Report Share Posted January 6, 2008 QUOTE(DaveKielpinski @ Jan 5 2008, 02:44 PM) Hi Ton,I've run into a similar problem and am having a hard time with it. Could you post about your solution? Thanks, Dave Here's a zip that solves this. Be aware it's not fail save and not yet finished. Ton Quote Link to comment
DaveKielpinski Posted January 7, 2008 Report Share Posted January 7, 2008 QUOTE(tcplomp @ Jan 6 2008, 01:16 AM) Here's a zip that solves this.Be aware it's not fail save and not yet finished. Ton Thanks for that. It is quite clear. It seems like you work around the basic problem (external User Events don't trigger an XControl) by having the shell VI change the Val(Sgnl) property of the XControl. Then the "Data Change" event fires and the User Events are processed normally. For my application this means that the shell VI is a simple event handler that duplicates some of the XControl functionality. In terms of the self-similar XControl hierarchy I posted about (http://forums.lavag.org/XControl-hierarchy-for-event-handling-t9793.html), this means each node in the tree has to have a daemon VI to wake it up when it gets a message from a descendent. Does anyone know whether the basic problem will be addressed in a new LV version? It seems kind of silly to have some User Events fire in XControls and others not, but maybe there is an underlying reason... Quote Link to comment
alundra87 Posted February 9, 2013 Report Share Posted February 9, 2013 QUOTE(JDave @ Nov 29 2007, 06:44 PM) I am using user events, you can see them in my Boolean XControl. Where I create the event registration in the Init ability and destroy them in the Uninit event. I fire events from methods and properties without problems and my facade VI gets triggered by them. However in my latest experience I have issues where I fire them from a callback VI, this doesn't trigger the facade VI. So it shouldn't give you any problems unless you get really fancy. Ton I know the topic is a little old but I found something strange (but positive) with the registering callback node.(LabVIEW 2012) I wanted to create a way to monitor the lost focus event. This event is not native in LabVIEW. So I tried to register a callback to react to a pane: mouse down event. When this event is triggered I check which control has focus and execute some code. In .vi form it doesn't work but as an executable it works great. I attached a simple code. Have a look to the init ability. Tried the unitTest.vi then the UnitTest.exe. Romain Xcontrol with focus lost event.zip Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.