[gtkada] set_property to a tag to justify text

Dmitry A. Kazakov mailbox at dmitry-kazakov.de
Sat Apr 20 11:30:44 CEST 2013


On Sat, 20 Apr 2013 10:23:33 +0200, you wrote:

> I'm developing a simple notepad using gtkada.
> I need to set a property to a text_tag to justify left/center/right a
> paragraph (not the whole text in the text_area, just to a paragraph)
> My code is:
> Tag := Buffer.Create_Tag ("jus_center");
> Set_Property (Tag,
>     Gtk.Text_Tag.Justification_Property,
>     Gtk.Enums.Justify_Center);
> 
> but it doesn't compile giving me this error:
> 
> no candidate interpretations match the actuals:
> programenvironment.adb:46:33: expected private type
> "Property_Font_Description" defined at pango-font.ads:265
> programenvironment.adb:46:33: found private type "Property_Boolean" defined
> at glib-properties.ads:117
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-font.ads:265
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:171
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:170
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:169
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:168
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:167
> programenvironment.adb:46:33:   ==> in call to inherited operation
> "Set_Property" at pango-enums.ads:166
> 
> Similar type-error happens even when I try coloring text, using the code
> found in the gtkada-example library
>  Color := Gdk.Color.Parse ("red");
>         Gtk_New (Tag, "red");
>         Add (Table, Tag);
>         Set_Property (Tag, Foreground_Gdk_Property, Color);

Set_Property for Gdk_Color is declared in Gdk.Color. If you not "use"-ing
it you should use a fully qualified name:

   Gdk.Color.Set_Property ...

Regarding Justification_Property I don't know if there exists a
Set_Property for it. You should probably implement it yourself. E.g. by
instantiating Glib.Generic_Properties.Generic_Enumeration_Property.

BTW, for a notepad you might consider GtkSourceView (e.g. for syntax
highlighting):

   http://projects.gnome.org/gtksourceview/

Ada bindings to GtkSourceView are available.

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


More information about the gtkada mailing list