[gtkada] Addressing external data in a GUI

Marc A. Criley m.criley at earthlink.net
Tue Jun 14 15:36:06 CEST 2005


> Here's the MAIN_QUESTION_:
> 
> How do you get data into a GUI, then access it within the GUI so that 
> the User can alter it using the GUI, then get it out of the GUI again?

I know what you're trying to do here, and I'm interested in finding out as
well.

However, what I've taken to doing instead is actually extending the relevant
Glade-generated class (since they're ultimately derived from a tagged type)
and adding in the data items I need.  This has worked out really well for
me.

Here's an excerpt of what I'm talking about, from the DTraq GUI code:

   -- Extension of the Data_Item_Display record that tracks
   --  information about the currently displayed item.
   type DID_Record is new Data_Item_Display_Pkg.Data_Item_Display_Record
with record
      Tap_Index : Tap_Item_Indices;
      -- Index of the data item

      Entry_Index : Log_Entry_Indices;
      -- Index of the entry within the log file.

      Review_Buffer : Data_Display.Transaction_Review_Buffer;
      -- Buffer for holding recently received data items for live review
   end record;

   -- Handle to extended Data_Item_Display record type
   type DID_Access is access all DID_Record'Class;

   -- Create an instance of a DID and populate it
   procedure Gtk_New (DID         :    out DID_Access;
                      -- DID to be created

                      Tap_Index   : in     Tap_Item_Indices;
                      -- Index of the data item

                      Entry_Index : in     Log_Entry_Indices := 0
                      -- Logfile index of the data item
                     );

   -- Set the values of a DID instance
   procedure Initialize (DID : access DID_Record'Class;
                         -- DID to be initialized

                         Tap_Index   : in     Tap_Item_Indices;
                         -- Index of the data item

                         Entry_Index : in     Log_Entry_Indices := 0
                         -- Logfile index of the data item
                        );


(DTraq source and binaries are available at www.mckae.com/dtraq.html.  New
and significantly  improved release coming soon! :-)

Marc A. Criley





More information about the gtkada mailing list