comp.lang.ada
 help / color / mirror / Atom feed
From: Jack Mitchell <jack@home9999.plus.com>
Subject: GTKADA gtk.extra.sheet.get_visible_range
Date: Mon, 23 Jul 2012 20:30:09 +0100
Date: 2012-07-23T20:30:09+01:00	[thread overview]
Message-ID: <JFL9X9ABZaDQFwj2@plus.net> (raw)

Has any-one else had problems with the Get_Visible_Range in
GTK.EXTRA.SHEET ?

The package body source is :-

   -----------------------
   -- Get_Visible_Range --
   -----------------------

   procedure Get_Visible_Range
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : out Gtk_Sheet_Range)
   is
      procedure Internal
        (Sheet : System.Address; The_Range : access Gtk_Sheet_Range);
      pragma Import (C, Internal, "gtk_sheet_get_visible_range");

      R : aliased Gtk_Sheet_Range;

   begin
      Internal (Get_Object (Sheet), R'Access);
      The_Range := R;
   end Get_Visible_Range;

The problem is that gtk_sheet_Range is an access, not the data itself :-

   type Gtk_Sheet_Range_Record is record
      Row0, Col0 : Gint;  --  Upper-left cell
      Rowi, Coli : Gint;  --  Lower-Right cell
   end record;

   type Gtk_Sheet_Range is access all Gtk_Sheet_Range_Record;
   --  A range in the sheet.
   --  This is a part of the sheet represented by its upper-left cell
and
   --  its lower-right cell.
   --  Most operations below apply to such ranges.



The best fix appears to be change the interface :-

   procedure Get_Visible_Range
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : out Gtk_Sheet_Range_Record)

However this would be incompatible (not a big problem since the current
code doesn't work)

OR change the implementation

   -----------------------
   -- Get_Visible_Range --
   -----------------------

   procedure Get_Visible_Range
     (Sheet     : access Gtk_Sheet_Record;
      The_Range : out Gtk_Sheet_Range)
   is
      procedure Internal
        (Sheet : System.Address; The_Range : access
Gtk_Sheet_Range_Record);
      pragma Import (C, Internal, "gtk_sheet_get_visible_range");

      R : aliased Gtk_Sheet_Range_Record;

   begin
      Internal (Get_Object (Sheet), R'Access);
      The_Range.All := R;
   end Get_Visible_Range;



This since the problem was found at work where Internet access is not
available, so this is being reported from memory.
However the change to the implementation does work at least under
windows.

N.B. Is any-one else using GTKADA ?


-- 
Jack Mitchell



             reply	other threads:[~2012-07-26 15:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 19:30 Jack Mitchell [this message]
2012-07-23 19:55 ` GTKADA gtk.extra.sheet.get_visible_range Dmitry A. Kazakov
replies disabled

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