WIDGET_TEXT - HOW TO NOT CHANGE VALUE OF TEXT WHILE EDITING FIELD? [message #34930] |
Fri, 02 May 2003 09:13  |
tbeetz
Messages: 9 Registered: May 2003
|
Junior Member |
|
|
i have a gui which has a few fields for changing motor positions as a
widget_text which was made /editable. i also run a timer which looks
up the motor positions every few seconds and updates the position in
that field.
sometimes it happens that i want to change one value and when i enter
the new value, the timer event kicks in and updates the field with the
current motor position and i have to start over again and press enter
before it updates again.
is there a way of telling idl not to change the value while the field
is edited?
thanks!
TOBI
|
|
|
Re: WIDGET_TEXT - HOW TO NOT CHANGE VALUE OF TEXT WHILE EDITING FIELD? [message #35006 is a reply to message #34930] |
Mon, 05 May 2003 17:31  |
condor
Messages: 35 Registered: January 2002
|
Member |
|
|
tbeetz@yahoo.com (Tobi) wrote in message news:<7f0cc27.0305020813.264732ab@posting.google.com>...
> i have a gui which has a few fields for changing motor positions as a
> widget_text which was made /editable. i also run a timer which looks
> up the motor positions every few seconds and updates the position in
> that field.
>
> sometimes it happens that i want to change one value and when i enter
> the new value, the timer event kicks in and updates the field with the
> current motor position and i have to start over again and press enter
> before it updates again.
How about saving the value of the widget somewhere and then get_value
right before you update it to check if it is still the same as before?
And skipping the update when something has changed (presumably because
the user edited something)?
|
|
|
Re: WIDGET_TEXT - HOW TO NOT CHANGE VALUE OF TEXT WHILE EDITING FIELD? [message #35010 is a reply to message #34930] |
Mon, 05 May 2003 12:41  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Tobi wrote:
> Ben, thanks for the suggestion, but i tried that before and didn't
> have luck with that... in my case, say the position is at 0.0 and i
> want to enter 3000, the program will start executing as soon as i type
> in 3 (it will not wait for me to also enter the other 000 since
> /all_events executes every entry). if i leave /all_events out and
> only set /editable, i can enter 3000 and hit <enter> to confirm. but
> in that case i have the problem which i described before, that another
> part of my program (whihc is an automated sequence, that updates the
> field) edits the field and sets it back to the value that it was at
> before ... removing the timer event is not desirable, since we have a
> lot of fields, that we want to have updated every few seconds ...
>
Hi,
Oh, I see now. I don't think you can eat your cake and have it, too.
The two tasks (getting input and indicating status) are at
cross-purposes because of your background task. Each should have its own
widget on the GUI. Even in a language like LabView - which is made for
this very interfacing purpose - all of the widgets are either 'controls'
or 'indicators' but not both when used in this kind of a loop.
If you are trying to use just one field because you are tight on GUI
space, you might change the 'current position' widget to a widget_label
which takes up less space (at least it does on Mac OS9 and Windows).
I struggle with this kind of problem a lot - I usually wind up with a
button (ala 'Apply' or 'Make It So') that triggers all of the 'stuff'
after the user gets things set up as desired. It's not slick - but most
users are familiar with the pattern. Programmatically, it means you
don't have to poll all of your widgets in a continuous loop.
Cheers,
Ben
>
> Ben Tupper <btupper@bigelow.org> wrote in message news:<3EB29D03.4030205@bigelow.org>...
>
>> Tobi wrote:
>>
>>> i have a gui which has a few fields for changing motor positions as a
>>> widget_text which was made /editable. i also run a timer which looks
>>> up the motor positions every few seconds and updates the position in
>>> that field.
>>>
>>> sometimes it happens that i want to change one value and when i enter
>>> the new value, the timer event kicks in and updates the field with the
>>> current motor position and i have to start over again and press enter
>>> before it updates again.
>>>
>>> is there a way of telling idl not to change the value while the field
>>> is edited?
>>>
>>> thanks!
>>>
>>> TOBI
>>
>> Hello,
>>
>> Take a peek at the /ALL_EVENTS and /EDITABLE keywords to the
>> WIDGET_TEXT() function. I think you want to set each of these - but you
>> have to communicate to the end user that a <return> or <enter> keystroke
>> is required. If this is the only field you are interested in polling
>> with the timer events, then you can actually remove the timer event (a
>> good thing to remove) Instead, use the event generated when the user
>> hits the enter key after editing your text widget.
>>
>> ben
>
|
|
|