Centering widgets relative to another.

Hello all,

I would like to be able to center windows / dialogs however not every
object seems to have a width and height.  And many objects do not have a
default x and y position.  Ideally I would like to have my top level
window appear at any position and then have subsequent dialogs appear
centered relative to the position of the top level window (which can
change if the user drags the window around).  I would like to have that
Windows feel where dialogs are positioned relative to their parents.
How can I acheive this?  I have tried and a few things work:

    -gdk_screen_width() and gdk_screen_height() return correct values
    -x and y positions return -1, -1 respectively (almost all the time
using gtk_widget_getv()).
    -width and height vary according to default widget properties but
still sometimes -1, -1 (vary using gtk_widget_getv()).

I don't want to force the position or size of my windows / dialogs.
What I do want is to get their size and position before they are
'show'ed and readjust according to another widget (say the top level
window).  Anybody got any ideas?

Thanks in advance,

Kristopher Kycia

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]