11-05-2019 11:54 AM
I have a cluster whose constituent objects I traditionally treat as a group of indicators since it seems every object in the cluster must be one or the other, together. I am now trying to trigger an event on a Boolean button inside the cluster and not have the cluster itself pick up on the event. This is because clicking on the red X (Boolean button) and the cluster itself will both be doing something, i.e., bringing up a menu or performing some specific action. I'd like to attempt to keep the overall cluster one event because I don't want the user to have to rely on clicking other various objects inside the overall cluster to trigger the cluster event.
I have changed the red X to a control and changed the mechanical action to 'switch when pressed.' This allows the user event to register the individual Boolean button before the Cluster event, in which I'd hoped to somehow then discard the Cluster event since I detected the red X was pressed. Even in doing that, everything becomes a control and thus the Valve image now shows its ring components as though you are trying to modify them. That is not what I want showing up.
This seems like it could be a common issue people face, so I'm sure there's some kind of solution, but I haven't been able to find a particular thread that addresses this.
Any suggestions would be appreciated, thanks. Project built in LV 2015.
11-05-2019 12:21 PM
Change Cluster to an indicator:
Do a mouse down? event for the Halt boolean. You can then decide to keep or discard the event. For event if you keep the event you can change the value of the boolean. I don't think you need any other event cases. Maybe I am not clear on what you are trying to do.
mcduff
11-05-2019 12:43 PM
I would recommend moving the Halt button out of the cluster which allows you to keep the valve UI element as an indicator and have the boolean button as a control.
You can still position the button over the cluster by selecting it and then using the keyboard's arrow keys to float it over the cluster.
That means you can easily separate the cluster click events from the button press events and you can event use mouse-down on the cluster.
Cheers
John
11-05-2019 01:36 PM - edited 11-05-2019 01:37 PM
Okay, I am back to Indicators and using the Mouse Down? event, which seems to work to allow the code to detect the Halt button event first, before the Cluster event.
Perhaps my understanding of discard and other Event features is what the real issue here is, so let me try to be more concise about what I'm trying to do:
- Halt button runs a popup, let's call it subVI A
- Anywhere else in the cluster runs a popup, let's call it subVI B.
When the user directly selects the Halt button, it triggers events for both the Halt and the Cluster, so both subVIs A and B would eventually pop up. I want a direct touch of the Halt button to only pop up subVI A, discarding subVI B originally used for touches on the general Cluster.
Thanks
11-05-2019 01:47 PM
@dest2ko wrote:
Okay, I am back to Indicators and using the Mouse Down? event, which seems to work to allow the code to detect the Halt button event first, before the Cluster event.
Perhaps my understanding of discard and other Event features is what the real issue here is, so let me try to be more concise about what I'm trying to do:
- Halt button runs a popup, let's call it subVI A
- Anywhere else in the cluster runs a popup, let's call it subVI B.
When the user directly selects the Halt button, it triggers events for both the Halt and the Cluster, so both subVIs A and B would eventually pop up. I want a direct touch of the Halt button to only pop up subVI A, discarding subVI B originally used for touches on the general Cluster.
Thanks
mcduff
11-05-2019 01:52 PM
Or even easier, keep both mouse down events for halt and cluster, discard the mouse down event(set boolean to true) when the halt button is triggered. This way you won't trigger another mouse down event for the cluster.
mcduff
11-05-2019 04:37 PM
Well, now when I have both events as Mouse Down? the Cluster event occurs first. I've also tried reading the status of the Boolean button to discard the Cluster event and it still executes all the code in the event window.
I may just have to individually event out every cluster.object or something to make it appear more "seamless"
11-05-2019 04:52 PM
Sorry, try the LAVAG solution using the mouse coordinates, the bounding rectangle. See Attached, you may not have all the VIs.
mcduff