07-05-2009 07:03 PM
Hello,
I have an array of clusters. Contained within each cluster are two numeric controls. One displays a value in decimal the other displays the same value in hex. I'd like the user to be able to enter values into either the decimal or hex numeric control and have the other field update while the user is typing.
I can create a key down event for the array. What I don't understand is how to get from the CtlRef to knowing which cluster in the array and then which specific control has changed.
Any help is greatly appreciated.
Solved! Go to Solution.
07-05-2009 08:33 PM - edited 07-05-2009 08:34 PM
It would be easier if you just had one control which displayed the value in two different formats, which you can do. For an I32 integer control:
Now the control will show two lines. The top will be decimal, the bottom will be hex. The user can enter the value whichever way they want.
Hmmm... Maybe Darren should turn this into a mini-nugget.
07-07-2009 01:26 PM
That's an excellent solution. I was able to extend your idea and also diplay the binary representation too.
One follow up, I've noticed the numeric value does not get placed into the variable unless the user clicks somewhere else on the front panel before clicking on a button. For strings I solved this using the 'update while typing' option. Is there a similar option for numeric controls or is there something I can do in my button event handler to force it to read the new value?
Thanks!!
07-07-2009 02:35 PM
I'm not sure I understand what you mean by "placed on the variable". The control's value doesn't get updated until the user presses the <Enter> key or clicks somewhere else (including a button). There is no option for a numeric control to update the value while typing. It sounds as if your button event handler is "Mouse Down". If you use "Value Change" then you can be sure that the numeric control's value will be updated before the button's event fires. See attached demonstration.
07-07-2009 02:38 PM
Ah, that was it exactly. I was using mouse down instead of value change with the event handler.
Many thanks!