Open_dialog with a transient parent



How exactly do I use Gtk.open_dialog from Gtk with a parent, and avoid this:

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Any MWE would be great, thanks!


How do you user open_dialog right now?
has a paragraph about
gtk_window_set_transient_for ()
and i’d guess this should be used to give a modal window like the dialog a parent.


Thanks for the tip, but I’m still not sure how I can specify that there is no parent window. What I do now is:

txtfile = open_dialog("Pick a `.txt` file", Null(), ("*.txt",))


and open_dialog is from where?


OMG, sorry: Gtk.

#6 says the second argument is the parent container.


Yea, but if I use their example, I still get that warning:

julia> using Gtk

julia> open_dialog("title", GtkNullContainer(), String[])
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Maybe there is no way to circumvent that warning?


The warning is there, because a Null container is somehow a non-window and therefore the parent is missing. Digging a little bit deeper: the warning shows up to inform you, that with a setup like this your window manager might not be able to manage the dialog window which can have strange side effects like sticking on your screen (happens a lot with tool tips from Gtk on windows).


I see. So it’s there to stick, unless I give it a real parent. But is there a clean simple way to do that? Like what would be the correct way to use open_dialog if that is the only need we have to communication with the user?


Afair (i haven’t done gtk application development for some time), a well behaving gtk GUI application should have an top-level application window to which you add menu, dialogs etc. If you only call open_dialog to ask for input and your application is terminal only, i’d guess you can live with the warning.


yes, this is the way I do this as well. The advantage when passing the top-level window is that one can set the dialog to be modal.


It makes sense. I guess one way “around it” is to open a transparent window as a default parent and kill it with the dialog.