08-01-2012 12:26 PM
I am planning to use a ring control in my VI and will programmatically open the control's drop down menu (list of ring items) at a certain time. The menu closes if the user selects an item from the list and also if the user clicks somewhere else on the VIs panel or outside the panel. If the user has selected an item from the list that causes the rings value to change, then a value change event will occur, but if they did not change the value such as by just clicking outside the menu, then a value change event does not occur. How can the closing of the menu be detected if the control's value has not changed? It would be nice if there is an event that can be used to detect this.
08-02-2012 05:27 AM
The first question is of course - what are you trying to do, why do you need to detect this?
Maybe alternative can be suggested by the users of this forum.
To solve your specific question I'd like some more details:
When do you open the menu? Can you make any predictions on the program state, mouse cursor position, etc. that you can exploit to solve your problem?
If you can post your VI(s) please do so. It will be really hard to help you otherwise.
Regards Florian
08-02-2012 12:07 PM
Here is some additional information about how the ring control is to be used. The ring control is to be used as an element of an XControl that I am trying to make. The XControl is a customized button to silence an audible alarm. The button is based on a boolean with some added functionality. It should behave as follows:
I was thinking of trying to detect when the menu closed (user had either selected an item from the ring control or closed the menu by clicking elsewhere) by giving it focus when the menu is dropped down and then checking for when the ring control lost focus, but this seems to have problems. Focus does not change when the user selects an item from the menu if that item was already selected. In this case, the ring retains focus and its value doesn't change either. How can I tell it was clicked?
I don't have code yet that I can attach.
Darin
08-03-2012 01:37 AM
That was extensive, thanks.
If it all comes down to "was it clicked?" couldn't you use the mouse button pressed event? Maybe a combination of that and the options you already mentioned, so you cover all cases.
Like: Give it focus, if it looses focus the user clicked elsewhere, if mouse button pressed the user selected something.
Regards Florian
08-03-2012 02:21 AM
Have you considered using a run-time shortcut menu to allow the user to select the time by right clicking on the button?
Similar functionality, but much easier to implement,
08-03-2012 12:34 PM
Hi Florian,
I thought that it might work to check for a mouse click event on the ring menu, but it turns out that no such event is generated. If you click on the ring control when the menu is closed, you get a mouse down for the ring control, but if you click on the menu when it is open, you don't get a mouse down for the ring control. Too bad, that would have been a useful solution.
Darin
08-03-2012 12:54 PM
I have tried using a shortcut menu, but that has some limitations. If the user clicks somewhere else other than on the menu, the menu closes without generating any event. For instance, if the shortcut menu is open and I press the <alt> key, the menu closes, but no event is generated and focus is not changed if some control has focus.
08-03-2012 03:09 PM