Showing posts from October, 2018

Applyings tags to gnocl widgets.

There are two ways in which widgets can be identified by a script: the wid returned on the creation of an object, and the use of the -name option. In both instances the interpretor will make an association betweem the two parameters and treat them as commands.

Now, consider what can be done if its necessary to hold meta information about a widget. At first one might think of using the -data option, which is fine up to a point. But, if the script needs access to a parameter of some sort that is passed to a callback handler then the obviouse choice is the use of the -data option. Doing so would allow that data to be accessed using the %p substitution parameter.

The glib apl allows us to assign various named string values to any g object. This could be anything, a desciption of the widget, some criteria which may result in the selective packing of widgets into a container. Perhaps even a tagged list.

The following code snippet shows how such data can be assigned, retrieved and manipulated.