comp.lang.ada
 help / color / mirror / Atom feed
* Need advice: Enumerate or not
@ 2002-05-15  9:42 Preben Randhol
  2002-05-15 12:26 ` Jim Rogers
  0 siblings, 1 reply; 10+ messages in thread
From: Preben Randhol @ 2002-05-15  9:42 UTC (permalink / raw)


Hi

I'm developing a GtkAda application. I have a window and in this window
I need to put an object depending on when the user wants. That is if he
wants to add words then I remove the object that is there and add the
object that deals with adding words, if he wants to be questioned then I
have to put another object etc...

What I'm wondering is that I now see that I need to call an update
procedure for the object that is currently in the window if the user has
done some changes in the preferences. The objects are all derived from
an object in Gtkada called Gtk_Frame, but they are in different packages
and the update procedure will also be in these seperate packages. So I
was thinking either I can do some dispatching thing or I can use
Enumerates like this: 

   with Listing;
   with Examine;
   with Setup;

   procedure Update (Which_Object : Object_Enum_Type) is
   begin
      case Which_Object is
         when Add =>
            Listing.Update;
         when Examine => 
            Examine.Update;
         when Setup => 
            Setup.Update;
         when others =>
            null;
      end case;
   end Update;

or

   with Listing;    use Listing;
   with Examine;    use Examine;
   with Setup;      use Setup;

   --  I would have to use use here which I don't like

   procedure Update (Object : access Gtk_Frame_Record) is
   --                         ^^^^^^^^^^^^^^^^^^^^^^^
   --                         Perhaps I need to write sth else here, I'm
   --                         not sure as I haven't tested it yet.
   begin
      Update (Object);
   end Change_Mode;

Which would be the more sensible way to go?

Thanks for any hints in advance.

Preben



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

end of thread, other threads:[~2002-05-16 19:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15  9:42 Need advice: Enumerate or not Preben Randhol
2002-05-15 12:26 ` Jim Rogers
2002-05-15 14:24   ` Preben Randhol
2002-05-16 13:03     ` Stephen Leake
2002-05-16 19:05       ` Preben Randhol
2002-05-15 18:00   ` Jeffrey Carter
2002-05-16  0:31     ` Jim Rogers
2002-05-16  2:37     ` Robert Dewar
2002-05-16 10:22       ` Preben Randhol
2002-05-16 17:36       ` Jeffrey Carter

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