| 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

Dialog

The Dialog class is a specialized version of the Dialogshell with four predefined buttons, "OK", "Cancel", "Apply", and "Help". By default the Dialog class provides automatic deactivation and status return following selection of either the "OK" or "Cancel" button. The status indicator is 1 for "OK" and 0 for "Cancel". Automatic deactivation may be disabled, enabling more user control over deactivation and status notification. In this case, the user must invoke the deactivate method explicitly and is free to pass a status return value as needed. For further information, see the Dialog manpage

Components: bbox hull separator
				

wm title . "Dialog Example"

##
##	Supporting proc to switch checkbutton's label
##
proc changeCheck {} {

	global check cs

	array set txt {0 "No" 1 "Yes"}

	$cs.cb configure \
		-text "$txt($check)"

	return

}; # end proc changeCheck

##=========================================================
##	Create the dialog iwidget
##=========================================================
##
iwidgets::dialog .d \
	-title "Dialog Example" \
	-modality application

.d hide Help

##
##	Change the deactivate commands for each
##	button
##
foreach b {OK Apply Cancel} {
	.d buttonconfigure $b \
		-command ".d deactivate $b"
}

##
##	Need to access the childsite
##	to add other widgets
##	
set cs [.d childsite]

##
##	Add a bitmap and a message
##
label $cs.quest \
	-bitmap questhead \
	-foreground red

message $cs.msg \
	-justify left \
	-width 200 \
	-text "Do you want to show this message next time"

checkbutton $cs.cb \
	-text "Yes" \
	-variable check \
	-indicatoron 0 \
	-command {changeCheck}

set check 1

pack $cs.quest $cs.msg $cs.cb \
	-side left

##
##	Do some positioning
##
.d center
update idletasks

##
##	Since modality was set to application,
##	then this will invoke the dialog iwidget
##	We just print it here for feedback
##
puts "User hit [.d activate]"

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