Re: Can't position modal compound widget (such as cw_form) [message #14686] |
Tue, 23 March 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Massimo Grion (mgrion@esrin.esa.it) writes:
> Using cw_form as a modal dialog, the widget always places itself on the
> top left corner of the screen. Is there a way to center it, without
> using cw_form inside an other widget?
I'd just modify the CW_FORM code (it's in the lib directory)
with maybe an XOffSet and YOffSet keyword. Then just set the
offsets on the temporary base widget that is created from
these values. This would take two minutes.
Here's a little utility routine Dick wrote to center
the top-level base of a widget. You could even use this.
Just call this routine with the top-level base identifier
before the widget hierarchy is realized.
CenterTLB, tlb
Widget_Control, tlb, /Realize
Cheers,
David
--
PRO CenterTLB, tlb
Device, Get_Screen_Size=screenSize
xCenter = screenSize(0) / 2
yCenter = screenSize(1) / 2
geom = Widget_Info(tlb, /Geometry)
xHalfSize = geom.Scr_XSize / 2
yHalfSize = geom.Scr_YSize / 2
Widget_Control, tlb, XOffset = xCenter-xHalfSize, $
YOffset = yCenter-yHalfSize
END ;; CenterTLB
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|