Re: Getting a modal run



On Thursday 21 April 2005 22:23, Bob Caryl wrote:
> Hello Everyone,
>
> I've derived a class from Gtk::Window.  I am running it from within
> another window thusly:
>
> Cashwin cw;
> cw.show();
> Gtk::Main::run(cw);
>
> This works fine, except that it is not synchronous.  I can get focus on
> the window that spawned this one and run it again.  I don't want this to
> happen.  The window is too complex to derive from Gtk::Dialog (I tried
> that).
>
> Assuming my assumptions about derivation from Gtk::Dialog were correct,
> any ideas?

Look at the set_modal(), set_transient_for() and set_sensitive() methods to do 
what you want.  (set_modal() is actually the one you are after if I 
understand your question, but you usually want to use it in combination with 
the others.)

I would normally use Gtk::Main::run() to enter the blocking loop and 
Gtk::Main::quit() to leave it, but Gtk::Main::run(Gtk::Window&) may work 
(although I normally reserve that for the main program object which, when 
closed, will terminate the program.)

Chris.

-- 
Summer is y-cumen in, lhude sing, cuccu!
Groweth sed and bloweth med, springeth the wude nu.



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