ianalis Posted November 10, 2008 Report Share Posted November 10, 2008 Hi! I want to have an event case triggered by a button click (via Value Change) and a menu item selection. I selected Menu Selection (User) to handle the menu selection and used Get Menu Selection to check the menu item selected. The event case is indeed triggered by Value Change and Menu Selection (User) when I ran it but the item tag and item path are both empty. The Get Menu Selection is wired to Current VI's menubar. Any ideas? Quote Link to comment
jgcode Posted November 10, 2008 Report Share Posted November 10, 2008 QUOTE (ianalis @ Nov 9 2008, 08:00 PM) Hi!I want to have an event case triggered by a button click (via Value Change) and a menu item selection. I selected Menu Selection (User) to handle the menu selection and used Get Menu Selection to check the menu item selected. The event case is indeed triggered by Value Change and Menu Selection (User) when I ran it but the item tag and item path are both empty. The Get Menu Selection is wired to Current VI's menubar. Any ideas? It is best to handle RTM selections like this when using event structure: http://lavag.org/old_files/monthly_11_2008/post-10325-1226237954.png' target="_blank"> Quote Link to comment
ned Posted November 10, 2008 Report Share Posted November 10, 2008 QUOTE (ianalis @ Nov 9 2008, 06:00 AM) I want to have an event case triggered by a button click (via Value Change) and a menu item selection. I selected Menu Selection (User) to handle the menu selection and used Get Menu Selection to check the menu item selected. The event case is indeed triggered by Value Change and Menu Selection (User) when I ran it but the item tag and item path are both empty. The Get Menu Selection is wired to Current VI's menubar. A very simple approach is to use the "Value Change (signaling)" property of your front panel control. When the menu selection occurs, wire a value to that property, which will cause the "Value Change" event to occur. An alternative is to create and register for a user event that duplicates a value change event, then handle that in the same case as value change as shown below. In your menu selection case, trigger that user event by using "Generate User Event. http://lavag.org/old_files/monthly_11_2008/post-3989-1226241343.png' target="_blank"> Quote Link to comment
ianalis Posted November 11, 2008 Author Report Share Posted November 11, 2008 QUOTE (ned @ Nov 9 2008, 03:36 PM) A very simple approach is to use the "Value Change (signaling)" property of your front panel control. When the menu selection occurs, wire a value to that property, which will cause the "Value Change" event to occur.An alternative is to create and register for a user event that duplicates a value change event, then handle that in the same case as value change as shown below. In your menu selection case, trigger that user event by using "Generate User Event. http://lavag.org/old_files/monthly_11_2008/post-3989-1226241343.png' target="_blank"> Thanks for the quick reply. I missed that property. Quote Link to comment
ned Posted November 11, 2008 Report Share Posted November 11, 2008 QUOTE (ned @ Nov 9 2008, 09:36 AM) An alternative is to create and register for a user event that duplicates a value change event, then handle that in the same case as value change as shown below. In your menu selection case, trigger that user event by using "Generate User Event. http://lavag.org/old_files/monthly_11_2008/post-3989-1226241343.png' target="_blank"> In case anyone else takes this approach, I just learned something from experimenting with it a bit more - the user data type does not need to match the actual event data type exactly. The user event data cluster can contain only a subset of the elements in the real event data, in which case LabVIEW will only allow you to access the ones that overlap. In my example above I could leave out "CtlRef" in which case the value change event would no longer have access to the control reference but the rest of the data will still be available. Quote Link to comment
Mark Yedinak Posted November 13, 2008 Report Share Posted November 13, 2008 When I create user events I use a variant as the data type. It provides the most flexibility since I can use it for whatever I want and make the data specific to the type of user event. This is the most general method and allows for extension of the user events without requiring any code rework. 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.