Skip to main content

Posts

Showing posts from November, 2012

gnocl::button -align

Yesterday I was playing with the Glade interface designer and noticed that the UI included buttons with icons whose contents were left aligned. The Gnocl default is centred and I thought that a gnocl::button -align option might be useful. The button icon and label sub-widgets are in turn held within a GtkHBox and positioned by a GtkAlignment container. It was a relatively simple task to create the code to add the alignment option. For the present, plain text will remain centred. Here's my test script. # test-buttonAlign.tcl #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Gnocl proc gnocl::buttonBox { {str <<TITLE>>} b} {     set box(1) [gnocl::box -orientation vertical -padding 0 ]     set but(1) [gnocl::button -icon %#Remove -text $str -align centre]     set box(2) [gnocl::box -orientation vertical -padding 0 ]     $box(1) add $but(1) -fill {1 1}     $box(1) add $box(2)     $box(2) add $b     $box(1) configure -

Getting Closer to Gnocl 0.9.97

Over the past few months a lot of modifications have been made to the development code to warrant a release increment albeit just by 0.0.01! Before this happens, it would be useful to hear from any (?) Gnocl users out there who are using the package and what they expect to see. Foremost, some feedback from users working with glade/builder files would be useful. The code for loading the xml files is something of a load and it might be more suited to branching out into a separate Gnocl family package. What would also be useful is any bug or performance reports from users. Many thanks...

gnocl::tooltip trigger

Did a little more to the demo script to show how the "trigger" sub-command actually works. # test-tooltip.tcl #! /bin/sh/ #\ exec tclsh "$0" "$@" package require Gnocl set lab(1) [gnocl::label -text "TANNOY" ] set lab(2) [ gnocl::label -text "CAMPER 1" -tooltip " Hi-Di-Hi!!! " ] set lab(3) [ gnocl::label -text "CAMPER 2" -tooltip "quiet" ] set box [gnocl::box -orientation  vertical ] $box add $lab(1) -expand 1 -fill {1 1} $box add $lab(2) -expand 1 -fill {1 1} $box add $lab(3) -expand 1 -fill {1 1} set main [gnocl::window -title "Rise-n-Shine" -child $box -setSize 0.125] #--------------- # create custom tooltip #--------------- # proc myToolTip {} {         # create custom tooltip window     set lab [gnocl::label -text " Ho-Di-Ho " -xPad 10]     set im [gnocl::image -image %#About ]     set box [gnocl::box -borderWidth 1 -shadow in]         $box add $im     $box add $lab     # keep cop

Entry widget undo/redo in Tcl.

Hacked together a simple proof of method script to implement Undo/Redo functionality for the gnocl::entry widget. There are some improvements that can be done such as overloading the basic entry widget to allow undo/redo as a widget command. Keyboard bindings are fully there too. I'll take a look at these at a later time. #--------------- # entryundo($ent)Redo.tcl #--------------- # Created by William J Giddings # October, 2012 #--------------- # Description: # Demonstrates simple entry undo($ent)/redo functionality. #--------------- # Notes: # cd /Desktop/GnoclEdit_2/undo($ent)er/wjgstuff # # This version has a single buffer to show edit history # #--------------- # basic Tcl/Gnocl Script #! /bin/sh/ #\ exec tclsh "$0" "$@" package require Gnocl #--------------- # #--------------- # proc entry:resetUndo {ent } {     global undo idx     set idx($ent) -1     set undo($ent) "" } #--------------- # #---------------

Customized Tooltip Windows

Gtk allows the user to create custom tooltips which might include mixed items such as icons, images and text. The recent addition of the gnocl::tooltip command to allows such things to be done. The following test script shows how its done. # test-tooltip.tcl #! /bin/sh/ #\ exec tclsh "$0" "$@" package require Gnocl set lab(1) [ gnocl::label -text "LABEL 1" -tooltip "I'm label #1" ] set lab(2) [ gnocl::label -text "LABEL 2" -tooltip "I'm label #2" ] set box [gnocl::box] $box add $lab(1) -expand 1 -fill {1 1} $box add $lab(2) -expand 1 -fill {1 1} set main [gnocl::window -title main -tooltip "HELLO WORLD!" -child $box -setSize 0.25] #--------------- # create custom tooltip #--------------- # proc myToolTip {} {         # create custom tooltip window     set lab [gnocl::label -text HIDIHI -xPad 10]     set im [gnocl::image -image %#About ]     set box [gnocl::box -borderWidth 1 -shadow in]         $box add $i