comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: Gtk Ada Message box example
Date: Mon, 31 Dec 2018 08:31:34 +0100
Date: 2018-12-31T08:31:34+01:00	[thread overview]
Message-ID: <5c29c5d6$0$31513$e4fe514c@news.kpn.nl> (raw)
In-Reply-To: <q08683$ol5$1@gioia.aioe.org>

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

Thanks for the information.
I just have remembered how it has to be done in Gtk and put in some standard 
package that wil position a message box with only one button which can do 
what I wanrted, just preenting a message

L. Dries

"Dmitry A. Kazakov"  schreef in bericht news:q08683$ol5$1@gioia.aioe.org...

On 2018-12-29 16:34, ldries46 wrote:
> I am searching for an example of showing a message box in Gtk.
> I have been programming in VC++ earlier and there it was simple tocreate a 
> message box because you only have to show it.
> I just want a message box with a title, a message and one button "OK". If 
> possble an Icon "Warning"
> both text items can be either in string format or in.
> I do not want to use glade anymore since it cannot present ada programming 
> language anymore.
> I just am glad with a link ho an example in Ada

    http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm

Package Gtk.Missed, procedure Message_Dialog.

Note it cannot be called from any Ada task other than the one running
the GTK messages loop.

For a procedure callable from any task see the package Gtk.Main.Router,
procedure Say.

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

[-- Attachment #2: message_box.adb --]
[-- Type: text/plain, Size: 1344 bytes --]

pragma License(Unrestricted);
--with Gtk;                         use Gtk;
with Gtk.Window;                  use Gtk.Window;
with Gtk.Dialog;                  use Gtk.Dialog;
with Gtk.Message_Dialog;          use Gtk.Message_Dialog;
with Ada.Strings.Unbounded;       use Ada.Strings.Unbounded;

package body Message_Box is

   procedure M_Box(Title : String;
                   Text : String) is
      MessageBox : Gtk_Message_Dialog;
   begin
      MessageBox := Gtk_Message_Dialog_New(null,
                                           1,
                                           Message_Warning,
                                           Buttons_Close,
                                           Text);
      MessageBox.Set_Title(Title);
      if MessageBox.Run <= 0 then
         MessageBox.Destroy;
      end if;
   end M_Box;

   procedure M_Box(Title : UnBounded_String;
                   Text : UnBounded_String) is
   begin
      M_Box(To_String(Title), To_String(Text));
   end M_Box;

   procedure M_Box(Title : UnBounded_String;
                   Text : String) is
   begin
      M_Box(To_String(Title), Text);
   end M_Box;

   procedure M_Box(Title : String;
                   Text : UnBounded_String) is
   begin
      M_Box(Title, To_String(Text));
   end M_Box;

end Message_Box;

[-- Attachment #3: message_box.ads --]
[-- Type: text/plain, Size: 625 bytes --]

pragma License(Unrestricted);
--with Gtk;                         use Gtk;
with Gtk.Window;                  use Gtk.Window;
with Gtk.Message_Dialog;          use Gtk.Message_Dialog;
with Ada.Strings.Unbounded;       use Ada.Strings.Unbounded;

package Message_Box is

   procedure M_Box(Title : String;
                   Text : String);
   procedure M_Box(Title : UnBounded_String;
                   Text : UnBounded_String);
   procedure M_Box(Title : UnBounded_String;
                   Text : String);
   procedure M_Box(Title : String;
                   Text : UnBounded_String);

end Message_Box;

      reply	other threads:[~2018-12-31  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-29 15:34 Gtk Ada Message box example ldries46
2018-12-29 16:09 ` Dmitry A. Kazakov
2018-12-31  7:31   ` ldries46 [this message]
replies disabled

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