comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Widget problems
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Widget problems [message #365] Mon, 18 May 1992 07:37 Go to next message
murthy_j is currently offline  murthy_j
Messages: 15
Registered: February 1991
Junior Member
I am just starting to use widgets and I'm having a lot of trouble with the
IDL hanging; I have to use a ctrl-z to stop the process. I suspect that most
of the problem was caused by my using a Draw widget and the mouse
generating thousands of events in that window. I have now switched over to
using a regular window for my graphics and just using widgets for buttons and
sliders.
Is this a common problem and is there any reason to use a Draw widget rather
than a regular window? Even now ISL hangs occaisonally; I think it is usually
when I move my mouse over another wdget immediately after selecting one.
I am running IDL v2.3.0 under IRIX 4.4.

Jayant Murthy, Dept. of Physics JHU.
Re: Widget Problem [message #4692 is a reply to message #365] Fri, 07 July 1995 00:00 Go to previous message
cavanaug is currently offline  cavanaug
Messages: 18
Registered: December 1994
Junior Member
In article <3thd4j$32l@lace.Colorado.EDU>, Jyothi Kirani <jvk> wrote :
> Can any one help ?
>
> I have written a small widget interface in which I have a bunch of text fields.
> I wanted to know whether I can move the cursor to the next text field as soon
> as a return key is hit in the previous text field, without using the mouse.
>
> If anyone has any ideas as to how to implement this, please let me know.
>
> Thanks,
> jyothi.


Here's a _very_ simple example of how you can change the input focus from one
text widget to another. Although I don't condone using common blocks as
state variables, I've done it here to keep things simple.


-------------------- C u t H e r e ---------------------------------------

; change_focus.pro Charles Cavanaugh July 1995
; simple demonstration of changing focus of text widgets

pro change_focus_event, event
common testdata, txt0, txt1, txt2, val0, val1, val2

; process the event
widget_control, event.id, get_uvalue = uval
case uval of

; if the return key was hit while txt0 had the input focus, change focus to txt1
'txt0' : widget_control, txt1, /input_focus

; if the return key was hit while txt1 had the input focus, change focus to txt2
'txt1' : widget_control, txt2, /input_focus

; if the return key was hit while txt1 had the input focus, change focus to txt0
'txt2' : widget_control, txt0, /input_focus

; read the text boxes and destroy the widget
'done' : begin
widget_control, txt0, get_value = tempval
val0 = tempval(0)
widget_control, txt1, get_value = tempval
val1 = tempval(0)
widget_control, txt2, get_value = tempval
val2 = tempval(0)
widget_control, event.top, /destroy
end
else :
endcase
end


pro change_focus
; save ids and values
common testdata, txt0, txt1, txt2, val0, val1, val2

; build the widget
base = widget_base (title = 'Changing Focus Demonstration', /column)
val0 = ''
txt0 = widget_text (base, xsize = 50, value = val0, uvalue = 'txt0', /editable)
val1 = ''
txt1 = widget_text (base, xsize = 50, value = val1, uvalue = 'txt1', /editable)
val2 = ''
txt2 = widget_text (base, xsize = 50, value = val2, uvalue = 'txt2', /editable)
done = widget_button (base, xsize = 50, value = 'Done', uvalue = 'done')

; realize the widget
widget_control, base, /realize

; set the initial input focus to whatever text box you want
widget_control, txt0, /input_focus

; register the widget
; and since common blocks are used to hold the state variables, this widget should be modal
xmanager, 'change_focus', base, group_leader = group, /modal

; print out the values returned from the text boxes
print, 'val0 is ', val0
print, 'val1 is ', val1
print, 'val2 is ', val2
end
--
Charles Cavanaugh | "Words are very unnecessary, they can only do harm"
cavanaug@ncar.ucar.edu | - Depeche Mode
NCAR Boulder, CO, USA | "Facts all come with points of view"
My opinions | - Talking Heads
Re: Widget problem [message #4694 is a reply to message #365] Fri, 07 July 1995 00:00 Go to previous message
klm5 is currently offline  klm5
Messages: 2
Registered: August 1994
Junior Member
In article <3thd4j$32l@lace.Colorado.EDU>, Jyothi Kirani <jvk> wrote:
> Can any one help ?
>
> I have written a small widget interface in which I have a bunch of text fields.
> I wanted to know whether I can move the cursor to the next text field as soon
> as a return key is hit in the previous text field, without using the mouse.
>
> If anyone has any ideas as to how to implement this, please let me know.
>
> Thanks,
> jyothi.
>


I believe the <tab> key will allow you to advance the cursor to the next
field without having to move the mouse. I've never tried coding this into
an application to move the cursor automatically, though.

Kip Matthews
k-matthews@uchicago.edu
Graduate Program in Medical Physics
The University of Chicago
Chicago, Illinois
Re: Widget problem [message #4700 is a reply to message #365] Thu, 06 July 1995 00:00 Go to previous message
patterso is currently offline  patterso
Messages: 36
Registered: February 1995
Member
Jyothi Kirani (jvk) wrote:
: Can any one help ?
:
: I have written a small widget interface in which I have a bunch of text fields.
: I wanted to know whether I can move the cursor to the next text field as soon
: as a return key is hit in the previous text field, without using the mouse.

: If anyone has any ideas as to how to implement this, please let me know.

: Thanks,
: jyothi.

I tried mailing you an answer but jvk as a mailing address doesn't
get very far :)

Anyway, here's my stab at it...

Could you put some sort of checking mechanism in the UVALUE associated
with each text field. Perhaps a UVALUE.NEXT flag. Check the UVALUE when
an event activates the callback, and if it is set, move to the next
field. If it is not set, don't move. I guess you would also need a
method of storing the widget ID of the next field, but again
you could use UVALUE.NEXT_ID. The only tricky bit would be to
fill this structure field correctly when you construct the
Widgets.

Hope this is some help. Sorry if I have totally misunderstood what you
were trying to do :)

Tim
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Widget problem
Next Topic: multi-surface plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:51:18 PDT 2025

Total time taken to generate the page: 0.00527 seconds