Skip to main content

Posts

Showing posts from March, 2020

List Row Colouration - Formatting a row of text in a list widget.

The way in which the tree and list widgets handle cell formatting is to emphasize data groups in the context a columns, and their background colouration. Specific cells are usually formatted based upon their contents, principally as foreground attributes although cell value contents can also be formatted using pango markup. Row formatting in comparison is principally used for assisting visibility such as changing alternating row colour hinting and treeline. Selected rows are temporarily highlighted. Unlike the column configuration options Gtk+ offers no equivalent for setting rows attributes. To achieve this, each cell value needs to be reset and specific attributes assigned. The following example shows how to set the foreground colour for cells in the same row.  #!/bin/sh #\ exec tclsh "$0" "$@" package require Gnocl #--------------- # create UI #--------------- proc main {} { set box [gnocl::box -orientation vertical] set ::list [gnocl::list \     -titles {...

gnocl::ribbon

I no longer use MS Windows but there is much talk of the "ribbon" widget used in MS products such as Word and Access. I originally came accross this type of layout many years ago when the MAYA 3D animation system was ported to Windows. Although it dominated the UI I could see its appeal and it mean that a lot of controls could be packed into a relatively small space. A ribbon bar, of course, is simply a megawidget with it children be compact versions of toobars, comboboxes and buttons.  Here a simple screen shot found on the web... And here a protype gnocl quivalent. The ribbon bar itself is simply a horizontal box into which table widgets are added. The table can then be given a group id and a title. In the example below the ribbon is contained within a notebook page.

New button options -orientation, -invert

The default settings for the gnocl::button are for the icon to be on the left and the label on the right. Not all  buttons need to be like this. Consider the toolbar button where the icon in above the label. These new options offer the programmer a little more flexibility when building a UI using Gnocl, especially when creating ribbon type containers. This is how the new settings look:  And the sample code: set hbox [gnocl::hBox]     set but1 [gnocl::button -text vertical -icon %#Info -data DATA -orientation vertical ] set but2 [gnocl::button -text vertical-invert -icon %#Info -data DATA -orientation vertical -invert 1] set but3 [gnocl::button -text horizontal -icon %#Info -data DATA ] set but4 [gnocl::button -text horizontal-invert -icon %#Info -data DATA -invert 1]     puts "but1 orientation = [$but1 cget -orientation]" puts "but3 orientation = [$but3 cget -orientation]" puts "but1 invert = [$but1 cget -invert]" puts "but2 inv...

March Update

Again, some time has passed since the last post but still work is going on. It would appear that most of the runtime issues arising from compiling against the Gtk 2.24 libraries are now resolved. Here's the relevant notices from the project NEWS file. As always, latest distributables available from Sourceforge. 2020-02:    gnocl::labelText         o label now positions to topLeft by default         o set command now works         o cget -value also works (same as set command)    gnocl::labelEntry         o cget -label now works properly    gnocl::info         o added option "tmp", returns location of system temporary directory    gnocl::scale         o added -heightRequest and -widthRequest    gnocl::comboEntry         o n...