comp.lang.ada
 help / color / mirror / Atom feed
From: randhol+abuse@pvv.org (Preben Randhol)
Subject: Re: Tasking with GtkAda
Date: Sat, 28 Apr 2001 11:19:10 +0000 (UTC)
Date: 2001-04-28T11:19:10+00:00	[thread overview]
Message-ID: <slrn9el9sf.lo.randhol+abuse@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: fthG6.1151$Ty6.16131@news1.oke.nextra.no

On Fri, 27 Apr 2001 18:52:04 +0200, Frank wrote:
> Hi!
> 
> Perhaps you can use a idle function in the Gtk client to poll for your data.
> I don't know if it is a optimal solution, but I have managed that work on a
> client task to server task (non-distributed)
> situation


I don't know if this is what you are looking for, but I have a small app
that displays GtkAda Dialogs using Ada Tasks. The program is not
finished so I have only included some of the code below to illustrate
how you can do it. Also look under doublebuffer in the examples that
follow GtkAda.

------------------
-- avtale.adb
------------------

with Notify_Task_Pkg; use Notify_Task_Pkg;

procedure avtale is

begin
    delay 5.0;
    loop          -- main loop do clever stuff here ;-)
      New_Dialog; -- call a Dialog to be shown using GtkAda
      delay 10.0; -- waits 10 second and then show a new dialog. Program
                  -- is not finished ! :-)
    end loop;

end avtale;

----------------------
-- notify_task_pkg.adb
----------------------

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions; use Ada.Exceptions;

package body Notify_Task_Pkg is

  task Notify_task is
    entry New_Dialog;
  end Notify_task;

  task body Notify_task is
  task body Notify_task is

  Notify_Dialog : Notify_Dialog_Access;
  begin
    Gtk.Main.Set_Locale;
    Gdk.Threads.Init;
    Gtk.Main.Init;

    loop
      select
         accept New_Dialog do
            Gtk_New (Notify_Dialog,
                  "This is a Notify widget that can be used with" & ASCII.LF &
                  "Ada 95 programs. It is completely written in " & ASCII.LF &
                  "Ada 95 using the GtkAda library.");
            Show_All (Notify_Dialog );
         end New_Dialog;
      else
         while Gtk.Main.Events_Pending loop
            Dead := Gtk.Main.Main_Iteration;
         end loop;
      end select;
      delay 0.01;
   end loop;

   exception
      when E : others =>;
         Put_Line ("Exception raised in GUI task:" &
                   Exception_Information (E));

  end Notify_task;

  procedure New_Dialog is

  begin
    Notify_Task.New_Dialog;
  end New_Dialog;

end Notify_Task_Pkg;


-- 
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
                 �For me, Ada95 puts back the joy in programming.�



      reply	other threads:[~2001-04-28 11:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-23  8:10 Tasking with GtkAda Tomas Hlavaty
2001-04-27 16:52 ` Frank
2001-04-28 11:19   ` Preben Randhol [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