Re: How to keep a widget in front? [message #5293] |
Thu, 16 November 1995 00:00 |
sjt
Messages: 72 Registered: November 1993
|
Member |
|
|
Gwyn F. Fireman (fireman@iuegtc.gsfc.nasa.gov) wrote:
: How do I keep an IDL widget in front of all windows? I have a small
: floating widget and don't want to lose sight of it when clicking on the
: larger widget behind it. I'd prefer not to use WIDGET_CONTROL,/SHOW as it
: would mean always passing the ID for the smaller widget to the event
: handler of the larger - and the two may be unrelated.
: Thanks in advance,
: Gwyn
: ---
: Gwyn Fireman, fireman@gsfc.nasa.gov, speaking only for myself.
Here's one kludge solution which I use:
1) Give a normally non-event generating widget [e.g. a base or a label --
hereafter called the dummy widget] within the floating widget a UVALUE
(assuming you handle your events by UVALUE).
2) After realizing the floating widget, send a timer event to the dummy
widget with a delay of (say) 2 seconds.
3) In the event handler for you floating widget have the event actio
for the dummy consist of:
widget_control, event.top, /show
widget_control, event.id, timer=2.0
While this won't make it un-hideable, at least it will pop to the front
every 2 seconds.
--
+------------------------+---------------------------------- --+---------+
| James Tappin, | School of Physics & Space Research | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+----------------------------------------------------------- --+---------+
|
|
|
Re: How to keep a widget in front? [message #5296 is a reply to message #5293] |
Wed, 15 November 1995 00:00  |
fireman
Messages: 49 Registered: August 1991
|
Member |
|
|
In article <48djln$b8f@post.gsfc.nasa.gov>, thompson@orpheus.nascom.nasa.gov (William Thompson) writes...
> Supposed that you added a TIMER event to
> your widget base. Then you could use that to bring the window to the
> foreground at regular intervals, e.g. once per second.
I followed up on Bill's suggestion by writing this little routine. I don't
know how far back timer events go, but it works just fine under IDL 3.6.1.
Sadly, I am bound to version 3.0.0, which doesn't have timer events; I'll
just have to pass around the widget IDs and use WIDGET_CONTROL,/SHOW.
------------------------------------------------------------ -------------------
PRO LITTLE_EV, EVENT
WIDGET_CONTROL, event.id, GET_UVALUE = eventval
if eventval eq 'EXIT' then WIDGET_CONTROL,event.top,/DESTROY
if eventval eq 'POP_FRONT' then WIDGET_CONTROL, event.top, /SHOW, timer=1
end
PRO LITTLE
base = WIDGET_BASE(uvalue='POP_FRONT')
button = widget_button(base, value='EXIT', uvalue='EXIT')
WIDGET_CONTROL, base, /REALIZE
WIDGET_CONTROL, base, timer=1
XManager, "LITTLE", base, EVENT_HANDLER = "LITTLE_EV"
end
------------------------------------------------------------ -------------------
Gwyn Fireman, fireman@gsfc.nasa.gov, speaking only for myself.
|
|
|
Re: How to keep a widget in front? [message #5297 is a reply to message #5296] |
Wed, 15 November 1995 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
fireman@iuegtc.gsfc.nasa.gov (Gwyn F. Fireman) writes:
> How do I keep an IDL widget in front of all windows? I have a small
> floating widget and don't want to lose sight of it when clicking on the
> larger widget behind it. I'd prefer not to use WIDGET_CONTROL,/SHOW as it
> would mean always passing the ID for the smaller widget to the event
> handler of the larger - and the two may be unrelated.
Gwyn:
Here's an idea that I haven't tested. Supposed that you added a TIMER event to
your widget base. Then you could use that to bring the window to the
foreground at regular intervals, e.g. once per second.
Bill Thompson
|
|
|