Re: Problem with modal widgets [message #8959] |
Tue, 20 May 1997 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Mark Rivers wrote:
>
> In article <337B5385.5AC8@bial1.ucsd.edu>, David Foster <foster@bial1.ucsd.edu> writes:
>> This will either be a good puzzle, or a stupid question. Enough said.
>>
>> I want to "truly center" a modal widget in the center of the screen,
>> meaning that you have to take into account the size of the widget
>> itself. Prior to IDL 5.0 I could do this by:
>>
>> * create widget
> * unmap widget
> * realize widget
>> * use WIDGET_CONTROL, wid, TLB_GET_SIZE to get the size
>> of the widget, and calculate position accordingly
>> * use WIDGET_CONTROL, wid, TLB_SET_[XY]OFFSET to position widget
>> * map the widget
>
> ...
>> And since you have to realize the widget before you can get the size
>> of it, I don't see a way around this problem.
>
> I have not looked at this specific problem, but in general you do NOT have to
> realize a widget to get its size. I frequently create dummy widgets which are
> never realized just to get their size, allowing me to then neatly lay out real
> widgets. Does this not work for your widget?
>
I just discovered the keyword GEOMETRY for WIDGET_INFO(), that returns
a structure containing many useful fields with regards to a widget's
geometry, and the widget does NOT have to be realized!
As far as I know, you cannot use "WIDGET_CONTROL, b, TLB_GET_SIZE"
to get the size of a widget before it is realized.
Thanks for the replies. Once I saw that Mark had done this, I knew
I missed another damn keyword *somewhere*!
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
"I have this theory that if we're told we're bad,
then that's the only idea we'll ever have.
But maybe if we are surrounded in beauty,
someday we will become what we see." - Jewel Kilcher
|
|
|
Re: Problem with modal widgets [message #8985 is a reply to message #8959] |
Fri, 16 May 1997 00:00  |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <337B5385.5AC8@bial1.ucsd.edu>, David Foster <foster@bial1.ucsd.edu> writes:
> This will either be a good puzzle, or a stupid question. Enough said.
>
> I want to "truly center" a modal widget in the center of the screen,
> meaning that you have to take into account the size of the widget
> itself. Prior to IDL 5.0 I could do this by:
>
> * create widget
> * unmap widget
> * realize widget
> * use WIDGET_CONTROL, wid, TLB_GET_SIZE to get the size
> of the widget, and calculate position accordingly
> * use WIDGET_CONTROL, wid, TLB_SET_[XY]OFFSET to position widget
> * map the widget
...
> And since you have to realize the widget before you can get the size
> of it, I don't see a way around this problem.
I have not looked at this specific problem, but in general you do NOT have to
realize a widget to get its size. I frequently create dummy widgets which are
never realized just to get their size, allowing me to then neatly lay out real
widgets. Does this not work for your widget?
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
|
|
|
Re: Problem with modal widgets [message #8994 is a reply to message #8985] |
Thu, 15 May 1997 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
I don't have IDL 5.0, but I have a real kludgy idea instead!
I hope I understood the problem correctly.
Could you work out the size of the widget using an unmapped,
non-modal version, then destroy that without ever actually
having displayed it and create a modal version to display at
the correct position all in the same widget routine?
This way you wouldn't have to map/unmap the "real" modal widget.
But it is extremely ugly!
Tim
PS personally I would do some sort of near-enough calculations
knowing what approximate size the widget will be and blame any
offsets on the monitor :)
David Foster wrote:
>
> This will either be a good puzzle, or a stupid question. Enough said.
>
> I want to "truly center" a modal widget in the center of the screen,
> meaning that you have to take into account the size of the widget
> itself. Prior to IDL 5.0 I could do this by:
>
> * create widget
> * unmap widget
> * realize widget
> * use WIDGET_CONTROL, wid, TLB_GET_SIZE to get the size
> of the widget, and calculate position accordingly
> * use WIDGET_CONTROL, wid, TLB_SET_[XY]OFFSET to position widget
> * map the widget
>
> Now, with IDL 5.0, and after I obediently put the /MODAL keyword in
> the WIDGET_BASE() call that creates the TLB instead of in the call to
> XMANAGER(), I get a widget that displays once, then repositions
> itself. This looks dorky, and I just can't have dorky programs!
>
> The problem is that in IDL 5.0 you cannot map/unmap "real" modal
> widgets (look at XMANAGER.PRO code and you'll see what I mean by
> "real", as opposed to "fake" modal widgets created by using
> XMANAGER, /MODAL).
>
> And since you have to realize the widget before you can get the size
> of it, I don't see a way around this problem. I could just leave
> the MODAL keyword in XMANAGER, but then you get that error message
> about an obsolete keyword, and our users will think I'm lazy or
> something.
>
> Thanks. -Dave
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
> David S. Foster Univ. of California, San Diego
> Programmer/Analyst Brain Image Analysis Laboratory
> foster@bial1.ucsd.edu Department of Psychiatry
> (619) 622-5892 8950 Via La Jolla Drive, Suite 2200
> La Jolla, CA 92037
> [ UCSD Mail Code 0949 ]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
--
Dr.Feelgood's Amazing And Marvellous Poetic Panacea
Guaranteed To Cure All Ailments Of The Soul
NO REFUNDS
http://condor.lpl.arizona.edu/~tim/
|
|
|