Re: Window position [message #6293 is a reply to message #142] |
Wed, 22 May 1996 00:00   |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Matthew Larkum <larkum@pyl.unibe.ch> wrote:
>
> Does anyone know how to find the position of an IDL window?
> That is, obtaining the information you set with:
>
> window, xpos=200, ypos=200
>
> back from the system and hopefully containing any user adjustments
> in the mean time.
>
One way is to use the widget creation routines to create the window:
b = widget_base( xoffset=xpos, yoffset=ypos )
d = widget_draw( b, xsize=512, ysize=512 )
widget_control, b, /realize
widget_control, d, get_value=window_id
Then you can use WIDGET_CONTROL to get info on the top-level-base:
widget_control, b, tlb_get_offset=xy_pos ; xy_pos=lonarr(2)
widget_control, b, tlb_get_size=xy_size ; xy_size=lonarr(2)
You can also get info using the GEOMETRY keyword to WIDGET_INFO().
You can reposition the widget with TLB_SET_OFFSET keyword to
WIDGET_CONTROL().
I never use IDL's WINDOW command because you have very little
control once you've made the window. It would be simple to make
a procedure to use the widget-creation routines to make a new
window and return the TLB widget ID (maybe as keyword). I do
something similar to this in all of my programs.
Hope this helps.
Dave Foster
foster@bial1.ucsd.edu
|
|
|