[gtkada] Addressing external data in a GUI

Stephen Leake stephen_leake at acm.org
Wed Jun 15 01:36:53 CEST 2005


Rick Duley <30294025 at student.murdoch.edu.au> writes:

> with Gtk.Window; use Gtk.Window;
> with Gtk.Box; use Gtk.Box;
> with Gtk.Label; use Gtk.Label;
> with Gtk.Separator; use Gtk.Separator;
> with Gtk.Button; use Gtk.Button;

Get rid of these use clauses; it will help!

> with Analyst;
>
> package Analyse60_Confirmation_Pkg is
>
>     type Analyse60_Confirmation_Record is new Gtk_Window_Record with
>        record
>
>        Confirmed : Boolean := False;
>
>        Analyse60_Confirmation_Vbox1 : Gtk_Vbox;
>        Analyse60_Confirmation_Label : Gtk_Label;
>        Analyse60_Confirmation_Hseparator1 : Gtk_Hseparator;
>        Analyse60_Confirmation_Hbox1 : Gtk_Hbox;
>        Analyse60_Confirmation_Cancel_Button : Gtk_Button;
>        Analyse60_Confirmation_Execute_Button : Gtk_Button;
>        end record;
>
>     type Analyse60_Confirmation_Access is
>       access Analyse60_Confirmation_Record'Class;
>
>     procedure Gtk_New
>       (Analyse60_Confirmation :    out Analyse60_Confirmation_Access;
>        Arguments              : in     Analyst.Arguments_Access_Type);
> end Analyse60_Confirmation_Pkg;

Note that you do _not_ define 'Gtk_Window' in this spec.

> The callback code I have is:
>
>     procedure On_Analyse60_Confirmation_Apply_Button_Clicked
>       (Object : access Gtk_Button_Record'Class)
>     is
>        Window : Analyse60_Confirmation_Access :=
>          Gtk_Window(Get_Toplevel(Widget => Object));
>     <------ line 38

So this 'Gtk_Window' is still Gtk.Window.Gtk_Window; not what you
want.

> analyse60_confirmation_pkg-callbacks.adb:38:09: expected type
> "Analyse60_Confirmation_Access" defined at analyse60_confirmation_pkg.ads:24
> analyse60_confirmation_pkg-callbacks.adb:38:09: found type
> "Gtk_Window" defined
> at gtk-window.ads:64

Exactly. 

Change to 

        Window : Analyse60_Confirmation_Access :=
          Analyse60_Confirmation_Access(Get_Toplevel(Widget => Object));

-- 
-- Stephe




More information about the gtkada mailing list