AW: [gtkmm] Dialog and MessageDialog?



I remember getting this to work with Gtk 1.2.
Have you looked at the dialog example ? They define a run() method in
the dialog class which returns with the answer after the user clicked
OK or Cancel.
 I believe it calls Gtk::Main::run() (better check on this again).
 The OK and Cancel signal handlers set a global variable in the dialog
 class and call Gtk::Main::quit(), so the control returns to the 
dialogs run method, which returns the global variable.

I didn't mess with delete_event_impl(), but instantiated a new
dialog every time I needed it.

Cheers,
	Elke
> 
> Sorry to go on with this, but I tried just using show(), and 
> the dialog gets 
> displayed for a millisecond, then immediately closes. I need 
> it to stay open 
> until the user clicks the "OK" button. It looks like there 
> may be a problem 
> with the "delete_event_impl" mechanism -- I ran the 
> hello,world example code 
> which is supposed to override the delete_event_impl() so the 
> window never 
> gets destroyed, and the override never gets called!
> 
> From the GTK 1.2 tutorial hello world example, the function 
> below NEVER gets 
> called!
> 
> int HelloWorld::delete_event_impl(GdkEventAny *event)
> {
>   cout << "delete event occured" << endl;
> 
>   // if you return false in the "delete_event" signal handler,
>   // GTK will emit the "destroy" signal.  Returning true means
>   // you don't want the window to be destroyed.
>   // This is useful for popping up 'are you sure you want to quit ?'
>   // type dialogs.
> 
>   // Change true to false and the main window will be destroyed with
>   // a "delete_event".
>   return true;
> }
> 
> Also - none of the examples that are shipped with gtkmm 1.2 
> make use of 
> ADDITIONAL popup windows. I would think this is such a common 
> thing that 
> SOMEONE would have done it already, no?
> 
> Thanks again,
> 
> Dave
> 
> 
> >From: Murray Cumming <murrayc usa net>
> >Reply-To: murrayc usa net
> >To: Key88 SF <key88sf hotmail com>
> >CC: gtkmm-list <gtkmm-list gnome org>
> >Subject: Re: [gtkmm] Dialog and MessageDialog?
> >Date: 11 Aug 2002 19:11:57 +0100
> >MIME-Version: 1.0
> >Received: from [209.116.70.73] by hotmail.com (3.2) with ESMTP id 
> >MHotMailBF1FF2CC00CA40043218D1744649CCFF0; Sun, 11 Aug 2002 
> 11:07:13 -0700
> >Received: from moniker.gnome.org (moniker.gnome.org [127.0.0.1])by 
> >mail.gnome.org (Postfix) with ESMTPid 5A8FA18849; Sun, 11 
> Aug 2002 14:07:05 
> >-0400 (EDT)
> >Received: from exchange.blueprint.net (unknown [195.13.99.210])by 
> >mail.gnome.org (Postfix) with ESMTP id CB35218205for 
> ><gtkmm-list gnome org>; Sun, 11 Aug 2002 14:06:28 -0400 (EDT)
> >Received: from [192.168.21.126] ([192.168.21.126]) by 
> >exchange.blueprint.net with Microsoft 
> SMTPSVC(5.0.2195.4905); Sun, 11 Aug 
> >2002 19:06:47 +0100
> >From gtkmm-list-admin gnome org Sun, 11 Aug 2002 11:07:14 -0700
> >Delivered-To: gtkmm-list gnome org
> >In-Reply-To: <F2511WgsxNKon644GkF00013b04 hotmail com>
> >References: <F2511WgsxNKon644GkF00013b04 hotmail com>
> >X-Mailer: Ximian Evolution 1.0.7 Message-Id: 
> ><1029089517 2186 270 camel localhost localdomain>
> >X-OriginalArrivalTime: 11 Aug 2002 18:06:47.0967 (UTC) 
> >FILETIME=[DC1322F0:01C24161]
> >Sender: gtkmm-list-admin gnome org
> >Errors-To: gtkmm-list-admin gnome org
> >X-BeenThere: gtkmm-list gnome org
> >X-Loop: gtkmm-list gnome org
> >X-Mailman-Version: 2.0.8
> >Precedence: bulk
> >List-Help: <mailto:gtkmm-list-request gnome org?subject=help>
> >List-Post: <mailto:gtkmm-list gnome org>
> >List-Subscribe: 
> ><http://mail.gnome.org/mailman/listinfo/gtkmm-list>,<mailto:g
tkmm-list-request gnome org?subject=subscribe>
>List-Id: gtkmm general discussion <gtkmm-list.gnome.org>
>List-Unsubscribe: 
><http://mail.gnome.org/mailman/listinfo/gtkmm-list>,<mailto:gtkmm-list-requ
est gnome org?subject=unsubscribe>
>List-Archive: <http://mail.gnome.org/archives/gtkmm-list/>
>
>On Sun, 2002-08-11 at 18:07, Key88 SF wrote:
> > Ok - how do I do something like that in gtkmm1.x ? I can build the GUI
> > window fine, but the "run_and_close()" equivalent I don't see how to do.

>The
> > only "run" and "response" methods are in the underlying Gtk objects.
>
>I don't think that there is any gtk_dialog_run() function in GTK+ 1.2.
>
>I think you just need to show() the dialog, and there's probably a
>response signal. But it would be better to look at the examples in gtkmm
>1.2.
>
>
>--
>Murray Cumming
>murrayc usa net
>www.murrayc.com
>
>_______________________________________________
>gtkmm-list mailing list
>gtkmm-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtkmm-list






_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



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