Re: dialog box outside its parrent window




On Jul 21, 2005, at 7:45 AM, Beast wrote:

I'm trying to use separate window by subclassing Gtk2::Dialog.
However, the placement is random, mostly it 'outside' of its parrent window. Is there any way to make this dialog box appear 'inside' parent window (something like MDI)?

If you mean "outside" in the sense of "the position of the child is unrelated to the position of the parent, and sometimes is many many pixels away rather than overlapping the parent", then you can do things like

   # for a dialog created with a parent
   $dialog->set_position ('center-on-parent');

If the dialog has no parent (e.g., you didn't pass a window reference to Gtk2::Dialog::new), then give it a parent with

   $dialog->set_transient_for ($parent_window);

"Transient" is X terminology that means a child window that is meant to exist for a short time. The net effect is that the child will stay on top of its parent in Z order at all times, will be iconified and deiconified with the parent, and will not show up in the panel's window list. This is customarily used for dialogs, toolboxes, floating toolbars, and any other window that you don't want to get lost behind the parent.


If you mean "outside" in the sense of "the window is independent, whereas i want it to be managed by the parent like MS Windows or Qt MDI", then you're out of luck, for gtk+ does not support this. In both win32 and qt, child-window MDI is done with a built-in window manager in the toolkit, which usually results in the child frames looking and acting quite different from toplevel windows managed by your window manager of choice.


If you're subclassing from Gtk2::Dialog, you're going to get an action area and other built-in behavior more suited to pop-up dialogs and floating windows than to MDI child (document) windows, so the first option is the best (for more reasons than merely "it's your only option").


--
How come hair colors for women take an hour, but "wash out the gray" stuff for men only five minutes? This is so unfair!
    -- Elysse, complaining about commercials




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