Re: [gtk-list] Re: Modal dialog - no more please!
- From: Jiang XU <jiang xu echostar com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Modal dialog - no more please!
- Date: Tue, 31 Aug 1999 10:18:14 -0600
Just remember, only put gtk_main() once in your application and put it in the
main().
It is very very complicate to put multi gtk_main() in an application (at least I
do not know how to do it), especially do not put it in some unimportant functions.
To achieve your purpose, you can write a standard warning message dialog by your
own hand, such as
Messagebox(title, text,type).
And use gtk_widget_show() to show it each time when you need it. Never put
gtk_main() in that, since you already put it in the main();
So the function will be:
run_dialog()
{
<create dialog with callbacks>
gtk_widget_show(dialog);
gtk_widget_destroy(dialog);
return result;
}
but if you do like this, the dialog will only show maybe 0.000..0001second (maybe
you even can not fell it) then it will be destroyed!! why? because you put
gtk_widget_destroy here. So better way it to put a button (like Close) and put
gtk_widget_destroy in that button call back function (such as clicked);
Sven Anders wrote:
> On Mon, 30 Aug 1999, Jiang XU wrote:
>
> > The code seems to be not all of them, you do not have signal connect........
> > any way, according to the code you show here,
> > Do not add gtk_main() in run_dialog(), insdead, put gtk_widget_destroy(dialog)
> > in a call back function of some signal connect with the dialog. then put the
> > gtk_main() in the main.cpp
> >
>
> Yes, aehm No!
> What I'm trying to do is to implement an easy call of some modal warning
> dialogs. I do not want a new callback for every warning dialog I create...
>
> The main() has the following structure:
>
> one_main_callback()
> {
> question = run_dialog();
> <do something>
> }
>
> main()
> {
> create_main_window_with_callbacks();
> gtk_main();
> }
>
> > > The structure is the following:
> > >
> > > callback()
> > > {
> > > <store result>
> > > gtk_main_quit();
> > > }
> > >
> > > run_dialog()
> > > {
> > > <create dialog with callbacks>
> > > gtk_widget_show(dialog);
> > > gtk_main();
> > > gtk_widget_destroy(dialog);
> > > return result;
> > > }
> > >
> > > My modal dialog drives me crazy ?!
> > > After closing the dialog and clicking to any other widget it
> > > mystically appears again. What's strange is that it does not
> > > happen always.
>
> Gruss
> Sven
> --
> .-------------------------------------------------------.
> .^. | Sven Anders, Germany | anderss@fmi.uni-passau.de |
> /V\ |----------------------| www.fmi.uni-passau.de/~anderss |
> // \\ | Sites I recommend: `--------------------------------|
> /( )\ | www.freshmeat.net www.enlightenment.org www.gnome.org |
> ^^-^^ `-------------------------------------------------------'
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]