02-16-2018 08:18 AM
Afternoon Gurus,
I am writing a piece of code which has several parallel event structures, each with several cases embedded. Within 3 or 4 of these cases I need to enable and disable many numeric controls. Always the same ones to the same state.
Rather than have a disabled property node for each controller in each case, I was thinking of having a new event with one set of the disabled property nodes in and then use a FGV as the selector (enabled, disabled, disabled and greyed), which is set in the cases. Is this a good way of doing this or is there something neater. Attached is a PNG which is just a simplification of the problem.
Mucho ta-ness!
02-16-2018 08:31 AM
First of all, you do not need 3 event structures. One structure is plenty if you have the proper underlying architecture.
For disabling a number of controls, I like to create a subVI that accepts an array of references and a boolean. Inside the subVI is an autoindexing for loop that loops thru all the references and disables/enables based on the value of the boolean. I'm sure there are more advanced solutions but this works well for me.
02-16-2018 08:32 AM
@MancPablo wrote:
I am writing a piece of code which has several parallel event structures
For a GUI, that is a bad idea. You should have 1 event structure handle all of the events for a GUI. Users are too slow to notice otherwise. If you need them to spawn off parallel processes, use a Queued Message Handler.
As far as your actual question, the more I see, the more confused I am for what you want.
02-16-2018 08:44 AM
Thanks guys,
I guess being self taught on LabVIEW shows. I shall go and Google Queued Message Handler and take it from there.
Paul
02-16-2018 09:02 AM
Ok, off piste here but looking at the QMH, it seems to be a different way of doing the same thing I am. The event handling loop is triggered by some user interface (a button is pressed or a value changed) and that is queued for the message handling loop. The MHL then dequeues and takes the appropriate action based on the message which will match a certain case within the MHL..
I have effectively a event handling loop, but instead of a queue, I am putting variables into a FGV and then triggering a case in a different event loop, which is the equivalent of the MHL.
or not?