comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Access check failed
Date: 03 Jan 2004 13:51:16 -0500
Date: 2004-01-03T13:51:16-05:00	[thread overview]
Message-ID: <mailman.206.1073155886.31149.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <4138e9c3.0401030603.9a4fe6e@posting.google.com>

gilmour@banda.lv (gilmour) writes:

> Why when I press 'Insert' button, following error appears?
> "CONSTRAINT_ERROR: win_new_employee_pkg.ads:25 access check failed"
> I'am using GtkAda-2.2.0

>    procedure On_Btninsert_Pressed(Object : access Gtk_Button_Record'Class)is
> 
>    begin
> 
>       Set_Text(win_new_employee.entry3, "");

This is referencing Win_New_Employee_Pkg.Win_New_Employee, which is
never set, so it is null, so you get an access check failure.

You need to get the parent of the parent of Object; that is the top
level window containing Entry3.

>    end On_Btninsert_Pressed;
> 
> end Win_New_Employee_Pkg.Callbacks;

> procedure Gtk_New (Win_New_Employee : out Win_New_Employee_Access) is
> begin
>    Win_New_Employee := new Win_New_Employee_Record;

This is the out parameter Win_New_Employee, _not_ the global
Win_New_Employee_Pkg.Win_New_Employee.

>    Win_New_Employee_Pkg.Initialize (Win_New_Employee);
> end Gtk_New;
> 

Here is a typical event handler from one of my applications:

procedure On_Enabled_Clicked (Button : access Gtk.Button.Gtk_Button_Record'Class)
is
  Check_Button : constant Gtk.Check_Button.Gtk_Check_Button := Gtk.Check_Button.Gtk_Check_Button (Button);
  View         : constant Gtk_View                          := Gtk_View (Gtk.Button.Get_Parent (Button));
begin
  View.Data.Enabled := Gtk.Check_Button.Get_Active (Check_Button);
end On_Enabled_Clicked;

Hope this helps.

There is also a GtkAda mailing list; see http://libre.act-europe.fr/

-- 
-- Stephe




  reply	other threads:[~2004-01-03 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-03 14:03 Access check failed gilmour
2004-01-03 18:51 ` Stephen Leake [this message]
2004-01-04 13:31   ` gilmour
  -- strict thread matches above, loose matches on Subject: below --
2004-09-03 12:11 access " Matthias Teege
2004-09-03 21:19 ` Stephen Leake
replies disabled

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