06-01-2009 05:49 AM
Hello. I have a text ring from which i need to get a event fired when any text (value) is selected. Now i have a event for Value change and it works ok when selecting a different value form the current, but what i would need is the same event fired even if i select the same text (value) that was selected previously. I can not use the mouse down event on the same control, because it will fire the event before any text (value) is selected.
If i create a property node (Val(Sgnl)) i can "remotely" fire the event, and in this case the Value change event for the text ring will fire even if i write the same value to the property node (Val(Sgnl)) many times. This is actually the behaviour i would like to have when clicking any of the values in the text ring with the mouse.
Any ideas on how to solve this?
Solved! Go to Solution.
06-01-2009 06:51 AM
06-01-2009 07:03 AM
Can you use the mouse up event, this returns a reference to the control, from this you can get value and strings[] property to determine the selected item, which should still work if an item is reselected. You might need to register for several events togetehe like key up, mouse leave ... to capture all permutations.
06-01-2009 07:52 AM
06-01-2009 09:07 AM
Setting aside the how, my question is why. Why would you need to execute the event again if nothing has changed?
Note: The wiring of the constant of 100 is completely unnecessary. This simply forces the while loop to do exactly nothing every 100 msec. Delete the constant. The event case will fire whenever a registered event occurs. In this case there is no need for polling.
06-02-2009 12:30 AM
Thank you krsone for this solution!
The answer to why i need the event executed if nothing has changed is that in my application the text ring will hold some predefined settings for some other controls. If the user selects one of the predefined settings from the text ring a bunch of other controls will take predefined values. These values in the other controls can now be altered by the user. If the user now wants to re-apply the same set of pre-defined settings as last time it should be as simple as selecting the pre-defined settings from the text ring. If now the same value is selected from the text ring, no event will be executed. (krsones solution will deal with this).
I would like to have this behaviour as a standard event.
06-02-2009 12:41 AM - edited 06-02-2009 12:42 AM
krsone,
Very nice solution,Yesterday i also tried for a few mins but i failed keep rocking and keep posting.
06-02-2009 01:02 AM
krsone wrote:
Just have a look at it : that's a very simple way to do what you need...
Youre kidding right? There is nothing "simple" about this solution. 😞
06-02-2009 01:23 AM
calle111 wrote:The answer to why i need the event executed if nothing has changed is that in my application the text ring will hold some predefined settings for some other controls. If the user selects one of the predefined settings from the text ring a bunch of other controls will take predefined values. These values in the other controls can now be altered by the user. If the user now wants to re-apply the same set of pre-defined settings as last time it should be as simple as selecting the pre-defined settings from the text ring. If now the same value is selected from the text ring, no event will be executed.
What you should do instead is change the value of the ring to a "special" value (e.g. using a local variable) whenever one of the other settings change, indicating that the settings have been modified. It seems wrong to show an inconsistent value in the ring, right?
Now, whenever you change it back to one of the default settings, is IS a value changed event and there is no problem. ;).
Here's a quick draft.
06-02-2009 07:53 AM
Based on your description of the way the user uses things, perhaps it would be better to have the user set up things and then hit an "Enter" button. In the Enter Value Changed event case, read all the rings and apply the process according to the values. The Enter button approach avoids all the issues of selecting what is already displayed. If the user likes what is shown, just hit Enter!
Lynn