09-29-2008 09:01 AM
I have a cluster of indicators that I use in several places in my program. I would like each cluster to have a "Reset" button to clear the data for the channel that the cluster represents.
Obviously, a cluster cannot have both controls and indicators. Also, an "OK Button" cannot be clicked if it is an indicator.
What is the best way to do what I'm trying to do?
09-29-2008 09:10 AM
Do you have an array of clusters where each element of the array represents a channel? or are all channels located within the same (one) cluster?
R
09-29-2008 09:11 AM
I'm not an expert but i would look at using local variables...
Though people advise caution when using local variables as they can increase the operation time/memory usage if used heavily, and can result in race conditions if incorrectly sequenced.
09-29-2008 09:23 AM - edited 09-29-2008 09:25 AM
I had planned to put 16 of these clusters in a larger cluster on the front panel, and iterate through each one every second.
Plan A:
I could make the entire cluster a control (to activate the OK Button) and disable (but not grey out) all other "indicators" (to prevent user modification). Since the cluster is a control, I'd modify the "indicators" using their "value" property.
However, I feel like going through all this trouble and using a "control" as an "indicator" is poor coding.
Plan B:
I could just place a button "on-top" of each instance of the cluster on the front panel.
However, I feel like the button should be part of the cluster.
--------
Thoughts?
09-29-2008 09:43 AM
I would not recomend that you use the value property. It's significantly slower than using a local variable. Used correctly and avoiding race conditions, a local variable is perfectly acceptable and very common. With many types of GUI's it's very common to use locals.
09-29-2008 09:45 AM
One other option is to make the cluster an indecator and then handle the mouse down event for the Reset Button. That is when the mouse down event occurs, set the button true, then wait .5 seconds, reset all including the reset button to false. This gives the feel of a true reset button but really your Cluster is an indicator.
09-29-2008 09:55 AM
09-29-2008 10:09 AM
Hi Paul,
I was thinking about suggesting your way. But I would feel the need of handling the mouse up event and the mouse move event, so the user might press but move the mouse away if suddenly unsure if he/she really wants to reset. That would be to much extra code.
Felix
09-29-2008 11:37 AM
09-29-2008 01:05 PM - edited 09-29-2008 01:07 PM
I agree that it may not be the most scalable solution, but just as a thought experiment:
You can set the mouse down event to change the boolean to True, and use the mouse leave and mouse up events to differentiate between backing out of the decision or actually selecting the action.