HOWTO: Center window on screen.
- From: Nikolaj Thygesen <mailinglist diamondbox dk>
- To: gtk-app-devel-list gnome org
- Subject: HOWTO: Center window on screen.
- Date: Mon, 16 Mar 2009 18:29:23 +0100
Hi list,
I've seen this question asked several times and even asked it
myself, so as I finally made it happen, I thought I'd share my success
with others in need. Simply putting:
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
at any creative point in your code seems to place windows at random
positions on screen. What works for me is putting:
gtk_window_set_type_hint(GTK_WINDOW(window),
GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
right before the final call to "gtk_widget_show_all(window);".
br - N :o)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]