11-09-2009 03:31 AM
Hi,
In my front panel there are some controls like in the following image:
I'm not able to do the following:
when I modify the "value" button by arrows (or by arrow keys), I want to modify its "increment property" according to "multiplier value".
if ( multiplier == 1.0 )
value.increment = 1;
else value.increment = 0.1
If I use the "value change" event on Value button, I miss the first update, becuase the event is processed AFTER the GUI rendering of the button. I tried different event, mouse enter and mouse down? but without success.
Any suggest?
Thanks
Solved! Go to Solution.
11-09-2009 03:38 AM - edited 11-09-2009 03:45 AM
Could you post an example VI?
I guess the increment value passed to the property is one iteration older.
Or you must update the property of Value control when the Multiplier Control's value is changed and not when Value control's itself?
Or you can use a string control for multiplier, and enable "Update Value While typing" for shortcut menu
11-09-2009 03:41 AM
You can use the "Mouse Enter" Event to detect when the user has or is going to select the control and at that point programatically set the increment or decrement value (Data Entry Limits:Increment). then, when the value is actually changed, you need do no more.
Shane.
11-09-2009 03:45 AM
I am not sure if such approach is possible at all.... so here a better solution:
You can programmatically change the increment/decrement value of controls. So you can configure an event on value change of the multiplier, read the value and set this as increment/decrement for your value-control.
You can find the increment/decrement-setting (its the same for both) in the property node in Data Entry Limits >> Increment.
hope this helps,
Norbert
11-09-2009 04:17 AM
What Norbert B said is the best way to do it (coupling the "multiplier" value change event to setting the increment value of the required control programatically).
Shane
11-09-2009 05:04 AM - edited 11-09-2009 05:06 AM
Even though its a better apraoch, there's one catch. If you try to click on value increment/decrement arrows right after changing the Multiplier (by entering numbers) without clicking nowhere, the incremental value will be the old set value for the first time. because the very next instance of mouse click would be on arrows, at the same time the multiplier event triggers, incrementing the Value control by previous increment preperty.
I hope i am clear in what i am trying to say.
So i would prefer to have a string control for multiplier, and enable "update value while tryping."and follow what Norbert B has suggested. This case, Multiplier value change event triggers for each key hit.
11-09-2009 05:46 AM
If you're doing thing serially (more than 100 microseconds apart) then there will be no problem.
There's something wrong with someone expecting to be able to change the values of two dependent controls simultaneousy without the possibility of problems.
I don't see the real problem with this approach to be honest. If you go the way Norbert has mentioned, there is no "mouse enter" event neccessary.
Shane.
11-09-2009 06:44 AM
Thanks for comments
I am attaching a VI for futher clarify the problem.
Made with LV8.5.1, you can see the is a kind of "bug".
See the comments inside the VI.
Front panel:
block diagram, one event case:
11-09-2009 06:57 AM
It seems you have misunderstood the suggection.
The code is OK but the event case should be for the control "Multiplier 1" and not for "Value 1".
When you change the multiplier, update the value for the increment.
Shane.
11-09-2009 07:01 AM - edited 11-09-2009 07:01 AM
Hi Slyfer,
See the attachment
I hope your first time arrow click is solved now?