[gtkada] Gtk.Extra.Sheet Help

Warren W. Gay VE3WWG ve3wwg at cogeco.ca
Fri Aug 27 17:41:34 CEST 2004


Sven Derben wrote:

>>I need to change the font of the CELLS in the
>>Gtk.Extra.Sheet widget (I need a fixed
>>width font, and font size change).
> 
>>If I supply the sheet widget for a font
>>change, only the labels for columns and rows
>>are affected.  The cells themselves remain
>>unchanged.
> 
> Did you look at Gtk.Extra.Sheet.Range_Set_Font?

No, that feature entirely escaped my attention.
That works, thank-you.

It does however, lead to a question that the
documentation doesn't seem to answer:

The type Gtk_Sheet_Range is an access type to
Gtl_Sheet_Range_Record. Who owns it after the
call? Should I free the range or does the
widget own the access to that record now?
See code below:

      declare
         Cell_Range : Gtk_Sheet_Range :=
            new Gtk_Sheet_Range_Record;
      begin
         Cell_Range.all := (
            Row0 => 0,
            Col0 => 0,
            Rowi => Gint(Rows),
            Coli => Gint(Columns)
         );
         Range_Set_Font(W,Cell_Range,Font_Desc);
         -- Do I Free Cell_Range now, or not?
      end;

If the access type is only used for the duration
of the call, then I should free it or use the
following code instead:

      declare
         Cell_Range : Gtk_Sheet_Range_Record := (
            Row0 => 0,
            Col0 => 0,
            Rowi => Gint(Rows),
            Coli => Gint(Columns)
         );
      begin
         Range_Set_Font(W,Cell_Range'Unchecked_Access,Font_Desc);
      end;

I think some sort of statement should be made about
these access types in the documentation. They are
critical issues to be understood by the programmer.

TIA, Warren.
-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg



More information about the gtkada mailing list