There are two basic widgets available for rendering simple text. The one is for displaying non-editable text
GtkLabel the other is for editable text
GtkLabel is the most basic text widget that has already been used behind the scene in any previous example involving a
GtkLabel is constructed by calling
label = @GtkLabel("My text")
The text of a label can be changed using
GAccessor.text(label,"My other text")
Furthermore, a label has limited support for adding formatted text. This is done using the
GAccessor.markup(label,"""<b>My bold text</b>\n <a href=\"http://www.gtk.org\" title=\"Our website\">GTK+ website</a>""")
The syntax for this markup text is borrowed from html and explained here A label can be made selectable using
This can be used if the user should be allowed to copy the text.
The justification of a label can be changed in the following way:
Possible values of the enum
Automatic line wrapping can be enabled using
GAccessor.text(label,repeat("Very long text! ",20)) GAccessor.line_wrap(label,true)
Note that this will only happen, if the size of the widget is limited using layout constraints.
The entry widget allows the user to enter text. The entered text can be read and write using
ent = @GtkEntry() setproperty!(ent,:text,"My String") str = getproperty(ent,:text,String)
The maximum number of characters can be limited using
Sometimes you might want to make the widget non-editable. This can be done by a call
# using the accessor methods GAccessor.editable(GtkEditable(ent),false) # using the property system setproperty!(ent,:text,false)
If you want to use the entry to retrieve passwords you can hide the visibility of the entered text. This can be achieve by calling
To get notfied by changes to the entry one can listen the "changed" event.
TODO: setting progress and setting icons in entry
A special variant of the entry that can be used as a search box is
GtkSearchEntry. It is equipped with a button to clear the entry.
GtkSearchEntry is not fully wrapped in Gtk.jl but if you add it using Glade, it can be used as an alternative to the `