comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Gtk.Message_Dialog
Date: Wed, 8 Sep 2021 17:02:51 +0200	[thread overview]
Message-ID: <shajap$20i$1@gioia.aioe.org> (raw)
In-Reply-To: 296e83e5-5855-4732-94ba-ed9c05f3dd6dn@googlegroups.com

On 2021-09-08 15:52, AdaMagica wrote:
> I need a two page message for a help button, so I have the callback
> 
>    procedure Help (Self: access Gtk.Button.Gtk_Button_Record'Class) is
>    begin
>      Show ("Page 1");
>      Show ("Page 2");
>    end Help;
> 
> where
> 
>    procedure Show (Message: Glib.UTF8_String) is
>      Dialog  : Gtk.Message_Dialog.Gtk_Message_Dialog;
>      Response: Gtk.Dialog.Gtk_Response_Type;
>    begin
>      Gtk.Message_Dialog.Gtk_New (Dialog,
>                                  Parent   => Parent,
>                                  Flags    => Modal,
>                                  The_Type => Message_Info,
>                                  Buttons  => Buttons_Close,
>                                  Message  => Message);
>      Response := Gtk.Message_Dialog.Run (Dialog);
>      Gtk.Message_Dialog.Close (Dialog);
>    end Show;
> 
> The problem is: When the first dialog's Close button is pressed, the next page appears, but the first is not closed. When the second page's Close is pressed, the window disappers, but the first dialog window is still there. Only pressing the red cross on the window's right upper edge closes the dialog.
> 
> What's wrong with my code?

You must call Destroy on the dialog to kill its window.

P.S. Note, that when the object reference is "floating" you have to sink 
it first before calling Destroy. However, in your case after Run all 
references must be OK.

P.P.S. Modal dialogs is the root of all evil...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-09-08 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 13:52 Gtk.Message_Dialog AdaMagica
2021-09-08 15:02 ` Dmitry A. Kazakov [this message]
2021-09-08 17:09   ` Gtk.Message_Dialog AdaMagica
2021-09-08 19:01     ` Gtk.Message_Dialog Dmitry A. Kazakov
2021-09-10 18:54       ` Gtk.Message_Dialog Mark Wilson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox