nicolasB Posted February 6, 2009 Report Share Posted February 6, 2009 Hello, I've created a variable manager in a functional global which generates a user event for each changed rsp set variable. The attached code is an example reduced to the minimum. It works fine but my question is if any of you see a possibility to get different names for the user events. Like you can see in the "MyVar1 and 2 Indicator.vi" both user events in the event structure have the same name and this is very inconvinient when the number variables/events increases. regards, nicolas Quote Link to comment
shoneill Posted February 6, 2009 Report Share Posted February 6, 2009 QUOTE (nicolasB @ Feb 5 2009, 02:14 PM) Hello,I've created a variable manager in a functional global which generates a user event for each changed rsp set variable. The attached code is an example reduced to the minimum. It works fine but my question is if any of you see a possibility to get different names for the user events. Like you can see in the "MyVar1 and 2 Indicator.vi" both user events in the event structure have the same name and this is very inconvinient when the number variables/events increases. regards, nicolas The User Event takes the name of whatever control or constant used to type it on creation AFAIK. I personally would prefer a NAME input for the creation of user events, but that's currently not how it's implemented. The current situation basically prevents creating user events in a loop because they than all have the same name. Shane. Quote Link to comment
Aitor Solar Posted February 6, 2009 Report Share Posted February 6, 2009 Probably the easiest solution is to typecast the user event reference into a user event reference with the name you want. Saludos, Aitor Quote Link to comment
Mark Smith Posted February 6, 2009 Report Share Posted February 6, 2009 QUOTE (nicolasB @ Feb 5 2009, 06:14 AM) Hello,I've created a variable manager in a functional global which generates a user event for each changed rsp set variable. The attached code is an example reduced to the minimum. It works fine but my question is if any of you see a possibility to get different names for the user events. Like you can see in the "MyVar1 and 2 Indicator.vi" both user events in the event structure have the same name and this is very inconvinient when the number variables/events increases. regards, nicolas It appears the event name in the event handler structure is going to be the same as the name of the control that it references. So, the only way I see to do this is to get the event in the called VI and load it into a control with a new name and then use that control to register the event. I don't really like this (it requires loading the control with a local variable or property node since just passing the data thru the control won't affect it) but it does work - see attached VI. Maybe someone else has a better idea. Mark http://lavag.org/old_files/post-1322-1233843289.vi'>Download File:post-1322-1233843289.vi OK, the typecast looks interesting but I think it would require care to make sure you don't get a run-time failure from an improper cast Quote Link to comment
LAVA 1.0 Content Posted February 6, 2009 Report Share Posted February 6, 2009 QUOTE (mesmith @ Feb 5 2009, 03:16 PM) OK, the typecast looks interesting but I think it would require care to make sure you don't get a run-time failure from an improper cast That is no problem, this is all done in compile time (the name of the event is part of the 'wire'). Ton Quote Link to comment
Mark Smith Posted February 6, 2009 Report Share Posted February 6, 2009 QUOTE (Ton @ Feb 5 2009, 07:50 AM) That is no problem, this is all done in compile time (the name of the event is part of the 'wire').Ton I was thinking more if your event datatype changed and you did not update the control/constant wired to the "Type" input you could get some really interesting run-time results! Mark Quote Link to comment
nicolasB Posted February 7, 2009 Author Report Share Posted February 7, 2009 Thanks at all! I think the Type Cast solution is working good for me. regards, Nicolas 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.