Re: [gtk-list] Modal dialogs




Robert Roebling <roebling@ruf.uni-freiburg.de> writes:

>   Good day again,
> 
> I wonder, how modal dialogs are implemented.
> 
> What I need is a function, which doesn't return until
> a modal dialog is destroyed again. This does not seem
> to be possible right now. Is there any chance, that an
> idle function might get implemented in future versions
> of the GTK. What I have to do is something like this:

> 
> bool  done = FALSE;
> 
> void callback_called_by_OK_button_in_modal_dia(...)
> {
>   done = TRUE;
> };
> 
> void foo(...)
> {
>   // create new modal dialog here
>   // connect OK-button signal to callback above
> 
>   while (!done) gtk_idle();   // continue main message iteration
                  ^^^^^^^^

change this to gtk_main_iteration() and it should work.
On the other hand, it's probably more standard to do this
as:

void callback_called_by_OK_button_in_modal_dia(...)
{
   gtk_main_quit();
};

void foo(...)
{
  // create new modal dialog here
  // connect OK-button signal to callback above

  gtk_main();

  // destroy dialog again

}

you probably want to put:

  gtk_grab_add (dialog);
   ...
  gtk_grab_remove (dialog);


in there too, or the user will probably get rather confused.

Regards,
                                        Owen



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