Showing posts from August, 2012

gnocl::text new option -variable

All of the standard entry widgets have a -variable option much like those encountered in Tk. This means that setting the value of a widget will cause a named variable to contain a copy of this data. The idea of using the -variable option lies in the ease of setting application wide settings or the setting or obtaining  values from a data entry form. The only exception to this was the text widget.

I've been working on a forms based dictionary and glossary edit library which needed something more than the standard gnocl::entry. After hacking around with Tcl scripts to gather data from a text widget I decided to work on the C-side of things. This required a little bit of tweaking of the C sourcecode which, as it would turn out, was an easier approach than scripting. It should be pointed out, however, that only plain unicode text will be copied. Any tags or invisible text will not be captured.

Here's the test script I used to work through the implementation.

# test-…

gnocl::label new option -resizable

If the label widget is used for well, labelling other widgets, the overall size of the label is pretty-well fixed and then only to a few number of words. But, the Gtk+ label is much more powerful than this. Because the widget is a container for pango text, its a really useful, high-speed alternative to the gnocl::text widget for the display of extensive pieces of text. Added to this, the use of pango markup, which is pretty well the same as a standard html string, makes run time formatting a something of a breeze.