Modal (blocking) dialogs




Hi all,

As a new gtk user, I've run across a question regarding event
processing.  I want to create a dialog that blocks event handling
until the dialog is dismissed.  Using gtk_grab_add() is not the behavior
I am looking for.  That function ignores all events except those from
the grabbed window.  What I would like is for the code to pause at
the invocation of the window, and wait for an event from that window.
The code is something like this:

int main(...)
{
    int x, y;

    gtk_init(...);
    
    x = show_dialog();
    y = show_dialog();

    gtk_main();
    
    return (1);
}

int show_dialog (void)
{
    build_dialog();
    wait_for_an_event();
}

I would like to have the code wait at the line x = ... until
an event is received from the modal dialog, then continue to
the next line, in this case popping up another dialog.  If
I just use gtk_grab_add(), the code above will show two dialogs
immediately, processing events only from the second dialog, then
when it's dismissed, from the first dialog.

In fact, I would like to be able to call show_dialog() from anywhere,
e.g., a callback function, meaning my code would be idle in gtk_main().

Thanks,

-bob

PS. One comment about gtk, and I hope no offense is taken by
the authors, as it's really a great piece of software, but the
documentation needs some work.  This makes it difficult (at least
for me :-) to use gtk.  That is one thing that was nice about 
xforms - the manual was very helpful.  This might seem like a
trivial point to the developers of gtk, but if you want people
to use the code, it's nice to have documentation ;-).   Again, I am
not trying to disparage gtk, I know how boring it is to write 
documentation, but in my opinion, the version should 
not have bumped to 1.0 without documentation of all functions.



--
Robert S. Mallozzi
http://cspar.uah.edu/~mallozzir/



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