SV: non-modal dialogs



> 
> On Thu, 2006-11-16 at 10:31 +0100, Morten Bo Nielsen wrote:
> > hi
> >
> > I have searching for a way to do non-modal dialogs. In my
application I
> > want to have multiple message boxes, that times out and destroys
> > themselves when done.
> >
> > I have made a class that extends the ordinary MessageDialog class,
and
> > overloads run() and on_delete_event. Code at the bottom.
> 
> I'm pretty sure that Dialog::run() is for modal dialogs.
> 
Just to clear things up for others to come. 

Dialog::run() makes the dialog modal, which means that you have to do
something else than use run() to make a non-modal dialog.

My error was that I got confused about threads. My non-modal dialogs
worked, but the non-modal part means that menus and other functionality
(like callbacks) is stille functioning. But Gtk::main::run() doesn't
exit until the dialog window is hide() or deleted.

I had assumed that gtk::main::run() spawned its own thread to allow the
rest of the program to continue running. Bad assumption.

(I overload dialog::run() to make it easy to change between my own
timeout dialog and the ordinary MessageDialog)

> I would just use show() and connect a signal_timeout handler that
called
> hide() or delete on the window (passed via sigc::bind, maybe) after a
> certain amount of time.
> 
Isn't it neccesary to use gtk::main::run() ?
and while we are at it: signals...

In my OnTimer function I would like to emit a delete_event. I can't find
any examples of that either. My solution is to call the
on_delete_event() function directly. 

Isn't it a good design to emit signals to communicate and initiate
events across windows?

regards
Morten





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