Hi,
I am learning about this, but have not totally figured it out. When I
make a new assistant window, it appears in the upper left of the screen.
Not at (0,0) but nearby.
assistant = gtk_assistant_new();
gtk_window_set_transient_for(GTK_WINDOW(assistant), transient_parent);
gtk_window_set_title (GTK_WINDOW (assistant), title.c_str());
gtk_window_set_modal (GTK_WINDOW (assistant), TRUE);
//gtk_window_set_position (GTK_WINDOW(assistant),
GTK_WIN_POS_CENTER_ON_PARENT);
// the above line does not center the assistant
gtk_window_set_destroy_with_parent(GTK_WINDOW(assistant), TRUE);
But the following kind of window IS centered:
projectdialog = gtk_dialog_new();
gtk_window_set_transient_for(GTK_WINDOW(projectdialog),
transient_parent);
gtk_window_set_title(GTK_WINDOW(projectdialog), _("Project properties"));
//gtk_window_set_position(GTK_WINDOW(projectdialog),
GTK_WIN_POS_CENTER_ON_PARENT);
// the above doesn't matter...with or without, the dialog is centered
gtk_window_set_modal(GTK_WINDOW(projectdialog), TRUE);
gtk_window_set_type_hint(GTK_WINDOW(projectdialog),
GDK_WINDOW_TYPE_HINT_DIALOG);
I don't understand it. Also, something in the gtk source code indicates
that setting the position of a window centered can cause problems or
doesn't work reliably, since it can "fight" with the window manager's
preferred placement.
Anybody who knows what they are doing with this?
On 6/21/2018 2:00 AM, Wojciech Puchar wrote:
nobody have idea?
On 2018.06.15 13:43, Wojciech Puchar wrote:
how to make dialogs appear on center of screen not on left corner.
tried multiple things no results. For normal windows
gtk_window_set_position works
for dialog it doesn't
below is example routine to ask a yes/no question from my program.
i've tried
gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);
but it doesn't work
nt pytanie(const char *txt) {
GtkWidget *dialog,*lab;
int odpowiedz;
dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT,
TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
lab=new_label(txt);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area
(GTK_DIALOG (dialog))), lab);
odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return (odpowiedz==GTK_RESPONSE_ACCEPT);
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list