basegui - combobox - dgw - drawcanvas - hyperhelp - sbuttonbar - seditor - sfilebrowser - sfinddialog - sqlview - statusbar - tablelist - tlistbox - tvmixins
dgw::sbuttonbar - snit widget for buttonbar with nice buttons having rounded corners, based on old gbutton code from Steve Landers.
package require dgw::sbuttonbar
namespace import ::dgw::sbuttonbar
sbuttonbar pathName options
pathName cget option
pathName configure option value
pathName insert item options
pathName itemcget item option
pathName itemconfigure item option value
pathName iteminvoke item
dgw::sbuttonbar - is a snit widget derived from a Steve Landers old gbutton code used in the old Tk Wikit application. It displays a nice button with rounded corners, more pleasant than the standard Tk button. The button can be configures as usually using the -command or the -state option. The -text option is however currently not available as the text per default currently is the given text at button creation time.
dgw::sbuttonbar pathName ?options?
Creates and configures the dgw::sbuttonbar widget using the Tk window id pathName and the given options.
-activefill color
the fill color for the buttons if they are hovered
-bg color
the color used as background color for the buttonbar
-disabledfill color
the fill color for the buttons if they are disabled
-fill color
the fill color for the buttons
-font fontname
the font used for the sbuttonbar text
-padx integer
the x-padding between the buttons
-pady integer
the y-padding for all buttons in the buttonbar .
Each dgw::sbuttonbar widget supports the following widget commands.
pathName cget option
Returns the given dgw::sbuttonbar configuration value for the option.
pathName configure option value ?option value?
Configures the dgw::sbuttonbar widget with the given options.
pathName insert text *?option value ...?
Insert the given text as an item into the buttonbar and configures it with the given option. See -itemconfigure for a list of available item options.
pathName itemcget text option
Returns the given configuration value for the item labeled with text. See -itemconfigure for a list of available item options.
pathName itemconfigure text option value ?option value ...?
Returns the given configuration value for the item labeled with text. Currently the following item options should be used:
pathName iteminvoke text
Invokes the command configure with option -command for the item labeled with text. Please note, that iteminvoke works all well for disabled buttons.
proc Cmd {state} {
global b0
tk_messageBox -type ok -message "Cmd"
if {$state == 0} {
$b0 itemconfigure Forward -state normal
$b0 itemconfigure Back -state disabled
} else {
$b0 itemconfigure Forward -state disabled
$b0 itemconfigure Back -state normal
}
}
pack [frame .f -bg #fff] -side top -fill x -expand no
pack [dgw::sbuttonbar .f.t -bg #fff] -side top ;# -fill x -expand no
set b0 .f.t
$b0 insert Back -command [list Cmd 0]
$b0 insert Forward -command [list Cmd 1] -state disabled
$b0 insert Home
$b0 insert End -command [list puts End]
$b0 itemconfigure End -state disabled
Installation is easy you can install and use the dgw::sbuttonbar package if you have a working install of:
For installation you copy the complete dgw folder into a path of your auto_path list of Tcl or you append the auto_path list with the parent dir of the dgw directory. Alternatively you can install the package as a Tcl module by creating a file dgw/sbuttonbar-0.6.tm in your Tcl module path. The latter in many cases can be achieved by using the --install option of sbuttonbar.tcl. Try "tclsh sbuttonbar.tcl --install" for this purpose.
Example code for this package can be executed by running this file using the following command line:
$ wish sbuttonbar.tcl --demo
The example code used for this demo can be seen in the terminal by using the following command line:
$ wish sbuttonbar.tcl --code
The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:
$ tclsh sbuttonbar.tcl --markdown
This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the --html flag.
$ tclsh sbuttonbar.tcl --html
This will directly create a HTML page sbuttonbar.html
which contains the formatted documentation.
Github-Markdown can be extracted by using the --man switch:
$ tclsh sbuttonbar.tcl --man
The output of this command can be used to feed a markdown processor for conversion into a man page, html or pdf document. If you have pandoc installed for instance, you could execute the following commands:
# man page
tclsh sbuttonbar.tcl --man | pandoc -s -f markdown -t man - > sbuttonbar.n
# html
tclsh sbuttonbar.tcl --man > sbuttonbar.md
pandoc -i sbuttonbar.md -s -o sbuttonbar.html
# pdf
pandoc -i sbuttonbar.md -s -o sbuttonbar.tex
pdflatex sbuttonbar.tex
The sbuttonbar widget was written by Detlef Groth, Schwielowsee, Germany.
dgw::sbuttonbar widget dgw::sbuttonbar, version 0.6.
Copyright (c)
This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions.
This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.