comp.lang.ada
 help / color / mirror / Atom feed
* Gtk Ada Message box example
@ 2018-12-29 15:34 ldries46
  2018-12-29 16:09 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: ldries46 @ 2018-12-29 15:34 UTC (permalink / raw)


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

L. Dries 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gtk Ada Message box example
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry A. Kazakov @ 2018-12-29 16:09 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gtk Ada Message box example
  2018-12-29 16:09 ` Dmitry A. Kazakov
@ 2018-12-31  7:31   ` ldries46
  0 siblings, 0 replies; 3+ messages in thread
From: ldries46 @ 2018-12-31  7:31 UTC (permalink / raw)


[-- 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-31  7:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox