[comp.windows.x] Xt geometry question

stumpf@lan.informatik.tu-muenchen.dbp.de (Markus Stumpf) (04/04/89)

I want to position a widget in the middle of the screen.
  I create a form widget as child of the toplevel widget. How do I get
the size of the form widget for calculating the postition of the
toplevel widget before realizing the toplevel widget.
  I made an
	XtRealize(form);
	/* get geometry stuff */
	XtManageChild(form);
	XtRealize(toplevel);
but I get an Protocol Error on XCreateWindow.

Thanks
  \Maex


+------------------------------------------------------------------------------+
|  Markus Stumpf                                                               |
|  TU Muenchen                        local: lan.informatik.tu-muenchen.dbp.de |
|  Inst. f. Informatik                  DFN: stumpf@{local}                    |
|  Arcisstrasse                        UUCP: stumpf%{local}@unido.uucp         |
|  D-8000 Muenchen                  ARPA/CS: stumpf%{local}@relay.cs.net       |
|  West Germany                      BITNET: infrza02@dm0tui1s.bitnet          |
+------------------------------------------------------------------------------+

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/19/89)

> I want to position a widget in the middle of the screen.
>   I create a form widget as child of the toplevel widget. How do I get
> the size of the form widget for calculating the postition of the
> toplevel widget before realizing the toplevel widget.

Can't be done, but you can get the information before the widget is mapped.
If you set mapped_when_managed to FALSE on a shell widget. I will not be 
mapped when it is realized.  This way you have relize the widget, get its size,
relocated it, and then map it.  This is a bit ugly, but it looks like it will
do what you desire.

                                                Chris D. Peterson
                                                MIT X Consortium