gtk_window_set_transient_for just works to dialog?



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 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.

If `windowB` is `Dialog` and not `Window` like below:
------------------------------> code start <------------------------------
windowB <- dialogNew
windowSetTransientFor windowB windowA
windowSetModal windowB True             
------------------------------> code end   <------------------------------

Above code haven't any problem, works fine.

And i check C docs about `gtk_window_set_transient_for`:
------------------------------> docs start <------------------------------
 * Dialog windows should be set transient for the main application
 * window they were spawned from. This allows <link
 * linkend="gtk-X11-arch">window managers</link> to e.g. keep the
 * dialog on top of the main window, or center the dialog over the
 * main window. gtk_dialog_new_with_buttons() and other convenience
 * functions in GTK+ will sometimes call
 * gtk_window_set_transient_for() on your behalf.
------------------------------> docs end   <------------------------------

Looks function `get_window_set_transient_for` just works with Dialog
windows? How to make it works with `Window`?

Or i missing something?

Thanks,

  -- Andy




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