comp.lang.ada
 help / color / mirror / Atom feed
* GTKADA gtk.extra.sheet.get_visible_range
@ 2012-07-23 19:30 Jack Mitchell
  2012-07-23 19:55 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 2+ messages in thread
From: Jack Mitchell @ 2012-07-23 19:30 UTC (permalink / 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



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

* Re: GTKADA gtk.extra.sheet.get_visible_range
  2012-07-23 19:30 GTKADA gtk.extra.sheet.get_visible_range Jack Mitchell
@ 2012-07-23 19:55 ` Dmitry A. Kazakov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry A. Kazakov @ 2012-07-23 19:55 UTC (permalink / raw)


On Mon, 23 Jul 2012 20:30:09 +0100, Jack Mitchell wrote:

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

Looks like a bug to me. Report it to gtkada mailing list:

http://libre.adacore.com/tools/gtkada/

As a work-around you can add a custom implementation differently named. And
use it instead.

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

Extensively.

Though I never used Gtk.Extra.Sheet, which is, well, too much Excel to me.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

end of thread, other threads:[~2012-07-26 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-23 19:30 GTKADA gtk.extra.sheet.get_visible_range Jack Mitchell
2012-07-23 19:55 ` Dmitry A. Kazakov

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