| 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

Notebook

The notebook iwidget is used to display various pages(windows) without using extra screen real estate. For further information, see the Notebook manpage

Components: cs hull
				

wm title . "Notebook Example"

set chapters [list introduction chapter_1 chapter_2]

##
##	Create a scrollbar to scroll through
##	the notebook pages.
##
scrollbar .sb \
  -orient horizontal \
  -command ".nb view"

pack .sb \
  -fill x \
  -side bottom

##=========================================================
##	Create a Notebook iwidget
##
##	Note: that the -height and -width
##	should be specified to get the
##	desired results (notebook visible)
##=========================================================
##
iwidgets::notebook .nb \
  -scrollcommand ".sb set" \
  -height 100 \
  -width 200

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

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

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

  text $page($p).text \
    -setgrid 1

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

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

  regsub -all {_} $p { } t

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

  $page($p).text insert end [string totitle $t] $p

}; ## end foreach chapters pages


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

##
##	Create a mechanism to page
##	through the notebook. Will create
##	some labels that represent chapters
##	in a book, and bind these to page
##	through the notebook
##
frame .topframe \
  -relief groove \
  -bd 4

pack .topframe \
  -fill x

##
##	Loop through the chapters list
##	and create a label for each chapter
##
foreach c $chapters {

  regsub -all {_} $c { } t

  label .topframe.$c \
    -text [string totitle $t] \
    -font {helvetica 12 underline} \
    -justify left

  pack .topframe.$c \
    -fill x \
    -expand true \
    -anchor s

  bind .topframe.$c <1> ".nb select $c"

}; ## end foreach label chapters

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