04-28-2014 11:22 AM
Like the subject says: I have a menu ring. I want to trigger an event if the user clicks on a menu item that is the same value it currently has.
I considered dynamically registering on "Ring: Mouse Down", then pulling value from that - but I can't figure out how to tell if they clicked inside or outside the menu box. I also can't assume the menu box it pops up is always the same size because I'm programmatically setting the values of the ring.
Any thoughts?
Solved! Go to Solution.
04-28-2014 11:25 AM
Use a "mouse up" event on the control, then read the value.
04-28-2014 11:39 AM - edited 04-28-2014 11:48 AM
@altenbach wrote:
Use a "mouse up" event on the control, then read the value.
I tried that - it doesn't work... unless I'm missing something.
Edit: To be more specific, the "mouse up" event never triggers. Mouse Down changes the focus from the control to the menu, which (it would apper) are different items. Similarly, the "Ring: Mouse Down" event only triggers when clicking the control itself, never when clicking the menu.
04-28-2014 12:21 PM
Can you switch to an enumerator? Using an enumerator and the Mouse Leave event will give you the desired effect.
04-28-2014 12:25 PM - edited 04-28-2014 12:39 PM
Sorry, posting by phone. Typically an event should only happen when the value changes, what's your use case here?
You could have a dummy entry on top (e.g. "please select") and reset to that after each selection event. Now the value always changes and you can use a plian "value changed" event.
04-28-2014 12:38 PM
@Citabria wrote:
Can you switch to an enumerator? Using an enumerator and the Mouse Leave event will give you the desired effect.
I tried "Mouse Leave" with the Ring. It didn't work. After a quick test, the Enumerator acts the exact same way - "Mouse Leave" triggers the moment you click.
04-28-2014 12:51 PM
@altenbach wrote:
Sorry, posting by phone. Typically an event should only happen when the value changes, what's your use case here?
You could have a dummy entry on top (e.g. "please select") and reset to that after each selection event. Now the value always changes and you can use a plian "value changed" event.
I considered adding the dummy, but I don't want it. It will work, but it is clunky, and I don't like building clunky GUIs 😛 If the user wants to add the same thing twice from a fairly large list, I don't want them to have to scroll down through the entire list and find it again - especially if they are doing this several times in a row.
As for what my use case: not relevant. I fully realize that there are several different ways to design the program - in fact, I have considered them. However, this is the one that will feel most natural to my users. I don't want to switch unless this is flat impossible.
04-28-2014 01:28 PM
That shed some light on the issue. Use a Combo Box. Any selection in a combo box is always a value change so you can use the Value Change event and capture the same selection twice. I tried it and this works. Selected "Test 1" over and over again and it always triggers Value Change.
04-28-2014 01:49 PM
Huh. I didn't think combo box would act differently. I wanted the numeric of the Ring or Enum, but I can convert back and forth between string and make this work. Thanks.
04-28-2014 01:54 PM
You can do what Altenbach says adding the dummy state. And add a Mouse Down event to cause it to Reinit to Default and a Value Change to catch the new value. This works for me on a menu ring, even when selecting the same value.