RE: [gtk-list] Re: Center a window
- From: Stefan Jeske <jeske braunschweig netsurf de>
- To: federico nuclecu unam mx
- Cc: gtk-list redhat com
- Subject: RE: [gtk-list] Re: Center a window
- Date: Sat, 08 Nov 1997 11:12:28 +0100 (MET)
On 08-Nov-97 Federico Mena wrote:
>> What's the best way to center a window (e.g. a dialog) on the screen ?
>
> Try the following:
>
> gtk_window_position(mywindow, GTK_WIN_POS_CENTER);
That was the first I tried... doesn't work.
If i use
window = gtk_dialog_new ();
[...]
gtk_window_position ((GtkWindow*)window, GTK_WIN_POS_CENTER);
gtk_widget_show(window);
the window gets placed randomly.
The only thing that seems to work is :
window = gtk_dialog_new ();
[...]
gtk_widget_show (window);
gtk_widget_set_uposition (window,
(gdk_screen_width()-window->requisition.width)/2,
gtk_screen_height()-window->requisition.height)/2);
But: you can see the window pop up somewhere and then center, and the
window manager decorations are not included in the calculations. :-(
Calling gtk_widget_set_uposition before showing doesn't work.
Ciao,
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]