| Itcl  | Itk  | Itcl @ Wiki  | Itcl @ SF  | Tcl  | Tcl @ Wiki |
  home || iwidgets || man pages cross ref distribution docs faq  
buttonbox
calendar
canvasprintbox
canvasprintdialog
checkbox
combobox
dateentry
datefield
dialog
dialogshell
disjointlistbox
entryfield
extbutton
extfileselectionbox
extfileselectiondialog
feedback
fileselectionbox
fileselectiondialog
finddialog
hierarchy
hyperhelp
labeledframe
labeledwidget
mainwindow
menubar
messagebox
messagedialog
notebook
optionmenu
panedwindow
promptdialog
pushbutton
radiobox
regexpfield
scrolledcanvas
scrolledframe
scrolledhtml
scrolledlistbox
scrolledtext
scrolledwidget
selectionbox
selectiondialog
shell
spindate
spinint
spinner
spintime
tabnotebook
tabset
timeentry
timefield
toolbar
watch

man page | options | methods

Tabset

The tabset iwidget contains a set of tab buttons. It displays the tabs in a row or column, depending on the-tabpos option. When a tab is click, it is brought forward, and the other tabs are set behind the active tab. This is seen in many tabnotebook type widgets, and in fact this iwidget is used in the Tabnotebook iwidget. This iwidget is not a general purpose widget, but is used to construct other iwidgets. For further information, see the Tabset manpage

Components: canvas hull
				

wm title . "Tabset Example"

set chapters [list introduction chapter_1 chapter_2]

##
##	Supporting procedure to show
##	the different pages
##
proc showTab {item} {

	.nb select $item

}; # end proc showTab

##=========================================================
##	Create a Tabset iwidget.
##
##	This will control the paging. This
##	is basically constructing a tabnotebook,
##	and is easier to implement using the
##	tabnotebook iwidget, but this example
##	is used for illustration purposes.
##=========================================================
##
iwidgets::tabset .ts \
  -equaltabs 0 \
  -tabpos n \
  -backdrop gray \
  -raiseselect 1 \
  -start 1 \
  -angle 0 \
  -bevelamount 6 \
  -command {showTab}

pack .ts \
  -fill both \
  -expand true \
  -side top

##
##  Create a Notebook iwidget
##
##
iwidgets::notebook .nb \
  -height 200 \
  -width 300

pack .nb \
  -fill both \
  -expand true \
  -side top


##
##	Fill in the different pages with
##	a text widget, and some text. The
##	pages can be filled in with any
##	widget.
##
foreach p $chapters {

  ##
  ##	Construct the page
  ##
  set page($p) [.nb add -label $p]

  text $page($p).text \
    -setgrid 1 \
	-background black \
	-foreground green

  pack $page($p).text \
    -fill both \
    -expand true

  $page($p).text tag configure $p \
    -underline 1 \
    -foreground yellow

  regsub -all {_} $p { } t
  set t [string totitle $t]

  ##
  ##	Add a tab for this page to the
  ##	tabset iwidget
  ##
  .ts add \
    -label $t

  ##
  ##	Insert some text into the
  ##	the pages
  ##
  $page($p).text insert end \
    "Here is where you will find all the info for "

  $page($p).text insert end $t $p

}; ## end foreach chapters

##
##	Select the first page; zero based
##
.ts select 0


Download this sample code
man page | options | methods
 
  home || iwidgets || man pages cross ref distribution docs faq  
Copyright | Contributions | Development Team | Credits
Bugs/Comments/Suggestions about this web site