Re: gtk_window_set_transient_for just works to dialog?
- From: David Nečas <yeti physics muni cz>
- To: Andy Stewart <lazycat manatee gmail com>
- Cc: gtk-list gnome org
- Subject: Re: gtk_window_set_transient_for just works to dialog?
- Date: Mon, 12 Oct 2009 10:59:12 +0200
On Mon, Oct 12, 2009 at 09:58:45AM +0800, Andy Stewart wrote:
> Hi all,
>
> I have problem with function `gtk_window_set_transient_for`,
> I use gtk2hs (Haskell binding for Gtk+),
> so don't care gtk2hs binding problem and Haskell code format, you can test my problem in C code.
I tried to test in C code...
> I have two window: `windowA` and `windowB`, I want make `windowB`
> keep above `windowA` and make `windowB` modal, `windowA` has created.
>
> ------------------------------> code start <------------------------------
> windowB <- windowNew
> windowSetTransientFor windowB windowA
> windowSetModal windowB True
> ------------------------------> code end <------------------------------
>
> But above code can't work, `windowB` don't display anything, `windowB` display blank.
...and it works exactly as it should.
#include <gtk/gtk.h>
int
main(int argc, char *argv[])
{
GtkWidget *windowA, *windowB, *entry;
gtk_init(&argc, &argv);
windowA = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(windowA), 300, 240);
g_signal_connect(windowA, "destroy", G_CALLBACK(gtk_main_quit), NULL);
entry = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), "Window A");
gtk_container_add(GTK_CONTAINER(windowA), entry);
gtk_widget_show_all(windowA);
windowB = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(windowB), 200, 160);
gtk_window_set_transient_for(GTK_WINDOW(windowB), GTK_WINDOW(windowA));
gtk_window_set_position(GTK_WINDOW(windowB), GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_set_modal(GTK_WINDOW(windowB), TRUE);
entry = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), "Window B");
gtk_container_add(GTK_CONTAINER(windowB), entry);
gtk_widget_show_all(windowB);
gtk_main();
return 0;
}
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]