📄 utilw32.tcl
字号:
-parent $ctrlVals(parentDialog) \ -modeless \ -controls $controls } set ctrlVals(parentDialog) $ctrlVals(mainWindow) windowQueryCloseCallbackSet $ctrlVals(mainWindow) quitCallback } customizeMainWindow $title return $ctrlVals(mainWindow)}############################################################################### customizeMainWindow - set the title of the wizard page## This procedure will set the title of the wizard page## SYNOPSIS# .tS# customizeMainWindow# .tE## PARAMETERS:# .IP title# title of the wizard page## RETURNS: N/A## ERRORS: N/A#proc customizeMainWindow {title} { global ctrlVals windowTitleSet $ctrlVals(mainWindow) $title foreach ctrl $ctrlVals(volatileFrm) { controlCreate $ctrlVals(mainWindow) $ctrl } set ctrlVals(jumpBack) 1}############################################################################### destroyVolatileFrm - close the wizard page## This procedure will close the wizard page## SYNOPSIS# .tS# destroyVolatileFrm# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc destroyVolatileFrm {} { global ctrlVals # First hide the controls to make it 'invisible', mainwin may be slow in # how it implements refresh logic on unix. foreach ctrl $ctrlVals(volatileFrm) { set pos [lsearch $ctrl "-name"] if {$pos != "-1"} { controlHide \ $ctrlVals(mainWindow).[lindex $ctrl [expr $pos + 1]] 1 } } # Then we destroy the controls foreach ctrl $ctrlVals(volatileFrm) { set pos [lsearch $ctrl "-name"] if {$pos != "-1"} { controlDestroy \ $ctrlVals(mainWindow).[lindex $ctrl [expr $pos + 1]] } } set ctrlVals(volatileFrm) ""}############################################################################### helpCallback - display html help## This procedure will display html help for that particular page## SYNOPSIS# .tS# helpCallback# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc helpCallback {} { global ctrlVals global LMHelpPath set anchor "" set tgsg "" set currPage [string tolower $ctrlVals(currPage)] if { [info exists LMHelpPath] } { set currPage "$LMHelpPath$currPage" } dbgputs "currPage: $currPage" if { [isUnix] } { set tgsg [file join [cdromRootDirGet] RESOURCE HELP "tgsg.hm"] } else { set rootDir "[cdromRootDirGet]\\" set tgsg [unixToDos [file join $rootDir RESOURCE HELP "tgsg.hm"]] } if { [catch {open $tgsg r} fileId] } { puts "ERROR opening tgsg.hm: $fileId" messageBox "HELP is not available" } else { while { [gets $fileId line] >= 0 } { set line [string trim $line] set lineList [split $line "="] set page [string tolower [lindex $lineList 0]] set page [string trim $page] if { [string match $page $currPage] } { set anchor [string trim [lindex $lineList 1]] dbgputs "tgsg.html anchor: $anchor" } } } if { $anchor == "" } { messageBox "Help is not available for this page!" return 1 } if { [isUnix] } { set helpFile [file join [cdromRootDirGet] RESOURCE HELP $anchor] } else { set rootDir "[cdromRootDirGet]\\" set helpFile [unixToDos [file join $rootDir RESOURCE HELP $anchor]] } dbgputs "Help file: $helpFile" if { [isUnix] } { if { [catch {exec ps | grep netscape} result] } { # if no Netscape browser currently open, try launching it if { [catch {exec netscape $helpFile &} result] } { # if no Netscape installed, warn user dialog ok_with_title "Online Help: Error!" \ "Cannot locate Netscape Navigator on this machine!\ \nNetscape Navigator 4.0 or higher is required\ for SETUP Help pages. Please be sure to\ install Netscape in order to access Help pages." } } else { # if Netscape is currently running, use same session catch {exec netscape -remote openURL($helpFile) &} result } } else { # windows # search for default internet browser foreach fExt ".htm .html" { if { ![catch {sysRegistryValueRead HKEY_CLASSES_ROOT $fExt ""} path] } { set path "$path\\shell\\open\\command" if { ![catch {sysRegistryValueRead HKEY_CLASSES_ROOT $path ""} browserPath] } { regsub -all {\"} $browserPath "" browserPath regsub -all {%.*} $browserPath "" browserPath regsub -all { -.*} $browserPath "" browserPath dbgputs "browser path: $browserPath" if { [catch {exec $browserPath $helpFile &} result] } { if { $fExt == ".html" } { dialog ok_with_title "Online Help: Error!" \ "Cannot locate any local internet browser on this machine!\nPlease\ be sure to install a browser in order to access Help pages." } } else { # no error launching break } } } } }}############################################################################### backCallback - close the current wizard page and return to the previous# wizard page## This procedure will close the current wizard page and return to the previous# wizard page## SYNOPSIS# .tS# backCallback# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc backCallback {} { global ctrlVals global setupVals # decrement the dialog index and re-create previous page set currPageIndex [lsearch $ctrlVals(pageList) $ctrlVals(currPage)] set prevPageIndex [expr $currPageIndex - 1] if {"$prevPageIndex" >= "0"} { set ctrlVals(lastPage) $ctrlVals(currPage) set ctrlVals(currPage) [lindex $ctrlVals(pageList) $prevPageIndex] reconstructPageList if { $setupVals(cmdMode) != "text" } { destroyVolatileFrm } pageCreate($ctrlVals(currPage)) } else { if { $setupVals(cmdMode) != "text" } { messageBox "Cannot go back further!" } else { puts "Cannot go back further!" } }}############################################################################### reconstructPageList - reconstruct the setup page list## This procedure will reconstruct the page list. It detects the current page# group and if the current page is the first elemet in the group,# it will remove the page list## SYNOPSIS# .tS# reconstructPageList# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc reconstructPageList {} { global setupPageList ctrlVals set pg $setupPageList(currPageGrp) set index [eval lsearch {$setupPageList($pg)} $ctrlVals(lastPage)] if {$index == 0} { # match the fist element in the list pageListRemove $pg } elseif { $index == 1 } { # in case lmReload -> Email/Phone (page lead was removed), # check if page lead of that group is in current page list set firstPage [lindex $setupPageList($pg) 0] set firstIndex [lsearch $ctrlVals(pageList) $firstPage] if { $firstIndex == -1 } { # if page lead is not there and current page is # the 2nd page from the group, remove pg group pageListRemove $pg } } dbgputs "reconstruct: $ctrlVals(pageList)"}############################################################################### pageListAdd - Add a new page list## This procedure will append a page group to the existing page list## SYNOPSIS# .tS# pageListAdd# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc pageListAdd {pageGrpName} { global ctrlVals setupPageList set ctrlVals(pageList) [eval concat $ctrlVals(pageList) \ $setupPageList($pageGrpName)] # add new page group set setupPageList(currPageGrp) $pageGrpName set setupPageList(pageGroupList) \ [concat $setupPageList(pageGroupList) $pageGrpName]}############################################################################### pageExists - Checks for existance of a page in ctrlVals(pageList)## This procedure will remove a page group of the existing page list## SYNOPSIS# .tS# pageExists page# .tE## PARAMETERS: page: the page to check for in the ctrlVals(pageList)## RETURNS: N/A## ERRORS: N/A#proc pageExists {page} { global ctrlVals if {[lsearch $ctrlVals(pageList) $page] == "-1"} { return 0 } else { return 1 } }############################################################################### pageListRemove - Remove a page list## This procedure will remove a page group of the existing page list## SYNOPSIS# .tS# pageListRemove# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc pageListRemove {group} { global setupPageList foreach i $setupPageList($group) { pageRemove $i } # remove the page group # pageGroupRemove set ix [llength $setupPageList(pageGroupList)] set ix [expr $ix - 1] set setupPageList(pageGroupList) \ [lreplace $setupPageList(pageGroupList) $ix $ix] set setupPageList(currPageGrp) \ [lindex $setupPageList(pageGroupList) end] dbgputs "removed pagegroup: $group" dbgputs "currentPageGrp: $setupPageList(currPageGrp)"}############################################################################### nextCallback - go to the next wizard page## This procedure will take Setup to the next wizard page as if next button# is pushed## SYNOPSIS# .tS# nextCallback
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -