WJG (21/05/10) Although Gnocl has a wide range of containers one noticeable area of functionality has been missing-the ability to specifically locate and resize a widget within its parent. The forthcoming release of Gnocl will have a number of new items in its widgets set one being gnocl::fixed, the bindings around the GtkFixed widget. The Gtk+ documentation generally discourages the use of this widget because Gnome users may, unlike their Windows and MacOSX cousins, use all sorts of different themes suited to either personal preference or visual impairment. As the result of this, Gtk needs dynamically resize widgets in order to properly display pango markup text. But then on the other hand, experienced Tk coders may prefer the use of the place command. With this caveat in mind, Tcl/Gnocl coders will soon be able to position widget directly to enable more 'creative' layouts.

Here's a screen shot of the current test script:

And here's the script:

# basic Tcl/Gnocl Script
#!/bin/sh \
exec tclsh "$0" "$@"
package require Gnocl

set but(1) 10
set but(2) 30
set but(3) 50
set but(4) 70

set but1 [gnocl::button -text "APPLE"]
set but2 [gnocl::button -text "BANANA"]
set but3 [gnocl::button -text "CHERRY"]
set but4 [gnocl::button -text "DAMSON"]

set fx [gnocl::fixed -label TEST -background red]
gnocl::window -child $fx -width 200 -height 130

$fx add $but1  -x $but(1) -y 10 -width 80 -height 40
$fx add $but2  -x $but(2) -y 30 -width 80 -height 40
$fx add $but3  -x $but(3) -y 50 -width 80 -height 40
$fx add $but4  -x $but(4) -y 70 -width 80 -height 40

$but1 configure -onClicked {
        if {$but(1) == 10} {set but(1) 110} else {set but(1) 10}
        $fx move %w  -x $but(1) -y 10 -width 80 -height 40

$but2 configure -onClicked {
        if {$but(2) == 30} {set but(2) 110} else {set but(2) 30}
        $fx move %w  -x $but(2) -y 30 -width 80 -height 40

$but3 configure -onClicked {
        if {$but(3) == 50} {set but(3) 110} else {set but(3) 50}
        $fx move %w  -x $but(3) -y 50 -width 80 -height 40

$but4 configure -onClicked {
        if {$but(4) == 70} {set but(4) 110} else {set but(4) 70}
        $fx move %w  -x $but(4) -y 70 -width 80 -height 40