|
Dialogshell
The Dialogshell class provides base class support for top level iwidget modal dialogs. This includes dialog mapping, button management, separator control, and a child site. The activate command maps the dialog and waits based on the modality. Non-modal dialogs return control immediately, whereas global and application modal dialogs wait until the deactivate command is invoked. The deactivate command accepts an optional argument which becomes the return value of the activate command. This provides dialog deactivation status notification.
For further information, see the Dialogshell
manpage
Components: bbox hull separator
|
wm title . "Dialogshell 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::dialogshell .ds \
-title "Dialogshell Example" \
-buttonboxpos e \
-modality application
##
## add buttons
##
foreach b {OK Apply Cancel Help} {
.ds add $b \
-text $b \
-command ".ds deactivate $b"
}
.ds default OK
##
## Need to access the childsite
## to add the other widgets
##
set cs [.ds 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
##
.ds 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 [.ds activate]"
|
Download this sample code |
|