::mdlWizardDlg
This command creates a dialog designed to easily contain multiple “pages”, multiple configurable buttons and a “built-in” message box to report messages.
Syntax
::model::mdlWizardDlg path
Application
MotionView Tcl GUI
Description
This command creates a dialog designed to easily contain multiple “pages”, multiple configurable buttons and a “built-in” message box to report messages.
Inputs
- path
- The name of the window that is to be created to contain the dialog.
Example
namespace eval ::my_wizard {
variable p_dlg ""
variable panel_list {}
variable current_panel 0
}
proc ::my_wizard::Run {} {
set mangle [::model::GetMangle my_wizard_Run]
variable p_dlg
variable current_panel 0
set p_dlg [::model::mdlWizardDlg wiz$mangle -width 600 -height 400 \
-title "My Wizard" -showExport false -callback "::my_wizard::OnClose"]
set frm [::model::mdlWizardDlg::GetButtonFrame $p_dlg]
::model::mdlWizardDlg::AddButtonToActionFrame $frm btnBack 4 "< Back" ::my_wizard::OnBack
::model::mdlWizardDlg::AddButtonToActionFrame $frm btnNext 6 "Next >" ::my_wizard::OnNext
::model::mdlWizardDlg::SetCloseButtonText "Finish"
variable panel_list [InitializePanelList]
DisplayPanel
::model::mdlWizardDlg::ShowDialog
}
proc ::my_wizard::InitializePanelList {} {
hwi GetSessionHandle sess1
sess1 GetProjectHandle pro1
sess1 ReleaseHandle
pro1 GetPageHandle pa1 [pro1 GetActivePage]
pro1 ReleaseHandle
pa1 GetWindowHandle win1 [pa1 GetActiveWindow]
pa1 ReleaseHandle
win1 GetClientHandle mcl
win1 ReleaseHandle
mcl GetRootObjectHandle mo
mcl ReleaseHandle
mo InterpretEntity en1 Point p_1 "\"Point 1\""
mo InterpretEntity en2 Point p_2 "\"Point 2\""
mo InterpretEntity en3 Point p_3 "\"Point 3\""
mo ReleaseHandle
return { en1 en2 en3 }
}
proc ::my_wizard::DisplayPanel {} {
set mangle [::model::GetMangle my_wizard_DisplayPanel]
variable current_panel
variable panel_list
set tmp [lindex $panel_list $current_panel]
$tmp GetObjectHandle pCurPoint$mangle
set lbl "My Wizard - [pCurPoint$mangle GetLabel]"
pCurPoint$mangle ReleaseHandle
::model::mdlWizardDlg::ChangeTitle "$lbl"
set frmParent [::model::mdlWizardDlg::GetDialogFrame]
grid rowconfigure $frmParent 0 -weight 1
grid columnconfigure $frmParent 0 -weight 1
catch { destroy $frmParent.frmPanel }
set frm [frame $frmParent.frmPanel]
grid rowconfigure $frm 0 -weight 1
grid columnconfigure $frm 0 -weight 1
set txt "Point: $lbl"
set wLbl [label $frm.lbl -text $txt]
grid $wLbl -row 0 -column 0
grid $frm -row 0 -column 0 -sticky nesw
UpdateBackNextButtonStates
}
proc ::my_wizard::UpdateBackNextButtonStates {} {
variable p_dlg
variable current_panel
variable panel_list
set nLastIndex [ expr { [llength $panel_list] - 1 } ]
set frm [::model::mdlWizardDlg::GetButtonFrame $p_dlg]
set bEnableBack [ expr { $current_panel > 0 && $nLastIndex > 0} ]
set bEnableNext [ expr { $current_panel < $nLastIndex } ]
if { $bEnableBack } { ::hwt::EnableCanvasButton $frm.btnBack } else { ::hwt::DisableCanvasButton $frm.btnBack }
if { $bEnableNext } { ::hwt::EnableCanvasButton $frm.btnNext } else { ::hwt::DisableCanvasButton $frm.btnNext }
}
proc ::my_wizard::OnNext { args } {
variable current_panel
incr current_panel 1
DisplayPanel
UpdateBackNextButtonStates
}
proc ::my_wizard::OnBack { args } {
variable current_panel
incr current_panel -1
DisplayPanel
UpdateBackNextButtonStates
}
proc ::my_wizard::OnClose { args } {
variable p_dlg
hwt::UnpostWindow $p_dlg
return 1
}
::my_wizard::Run
Errors
None.