Re: Nesting gtk_main ?

On 2/1/2010 2:56 PM, Chris Vine wrote:
Martin Vejnár<avakar ratatanek cz>  wrote:
How do I make the dialog's parent ignore user input? Event if I call
gtk_window_set_transient_for(dialog, parent), the parent remains

If you want this, then why not call gtk_dialog_run() and have a
blocking dialog?

Yes, sorry, the context got lost somewhere up-thread. I definitely would prefer to use gtk_dialog_run(), but unfortunately I have two windows that I'd like to be independent, and from what I gathered from this discussion, I can't use the function in that case.

However, if you have a special reason why you want to
do it without a recursive call to gtk_main(), then use
gtk_window_set_modal() as well as gtk_window_set_transient().

Thank you, gtk_window_set_modal() is the answer! It's not that simple, though. I had tried gtk_window_set_modal() before, but it had made both of the windows inactive.

Since you mentioned the function, I decided to give it one more try. This time, however, I put the windows into separate window groups and that worked like a charm.

The documentation for gtk_window_set_modal for version 2.19 says:
Modal windows prevent interaction with other windows in the same

It would probably be better if it said "in the same window group", that would have led me straight to the solution.

On 2/1/2010 2:56 PM, Chris Vine wrote:
As a further sophistication you can set the parent insensitive with
gtk_widget_set_sensitive(), but if you do that you will need to set
the parent sensitive again when the dialog is finished with (say by
connecting a callback to the destroy and/or hide signal).

I had tried that as well, but it grayed out the controls of the window (which is undesirable) and the window still responded to the close button.

Thanks again,

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