The widgets in the Tk package have the really nifty sub-command cget which enables the settings for widget options to be extracted. Implementation of cget functionality within Gnocl is patchy for the most part as in most cases custom code needs to be added to extract settings. I've just added cget -baseFont for the text widget. This means that simple text zooming can be implemented in conjunction with the -onScroll option.
#---------------
# text widget zoom
#---------------
# arguments
# w text widget id
# d direction of scroll, ie up or down.
# s state of keytboard modifiers, must be Ctrl+scroll to run.
# returns
# nil
proc TextZoom {w d s} {
if { [$w class] != "text" } { return -1 }
set fnt "[$w cget -baseFont]"
set fsize [lindex $fnt 1]
if {$s != 4} { return }
switch $d {
up { incr fsize 2 }
down {incr fsize -2 }
}
lset fnt 1 $fsize
eval $w configure -baseFont [list $fnt]
}
Tuesday, September 18, 2012
Subscribe to:
Comments (Atom)
-
Given this module some attention today. Added some of the more package wide options to the module and created customised handler for settin...
-
Spent some time today creating some simple howto-tutorials on creating standalone Tcl/Gnocl applications using freewrap. The process is almo...
-
Linux distros have heaps of pre-installed icons ready for use. I recently needed to create a toolbar menu which needed to access a set of un...