home *** CD-ROM | disk | FTP | other *** search
-
- ############################################################
- ###
- ### help window
- ###
- ############################################################
-
- ##
- ## redo this with text widget instead of message widget
- ##
- ## issues:
- ## message widget will not resize its width
- ## text widget will not resize its height
- ##
- ## hardcode window size for now XXX dangerous
- ##
-
- proc helpOpenURL {url} {
- set netscape [Shell_DoesBinaryExist_Prompt {netscape}]
- if {$netscape == ""} {
- DialogWin .error "Help System Error" \
- "Could not find netscape. URLs will not be available." {} 0 OK
- return
- }
-
- if [catch {exec $netscape \
- -remote "openURL($url, vmware-window, raise)" >& /dev/null} err] {
- if [catch {exec $netscape $url >& /dev/null &} err] {
- DialogWin .error "Help System Error" "Can't open $netscape." {} 0 OK
- }
- }
- }
-
- proc helpBind {wind tag event body} {
- regsub -all {%W} $body $wind body
- regsub -all {%T} $body $tag body
- $wind tag bind $tag $event $body
- }
-
- proc helpWindow {name title text urls} {
- if {[winfo exists $name]} {
- set children [winfo children $name]
- foreach child $children {
- destroy $child
- }
- } else {
- catch {destroy $name}
- toplevel $name
- }
-
- wm title $name "$title Help"
- wm iconname $name Dialog
- wm minsize $name 400 400
-
- raise $name
-
- button $name.ok -text OK -width 7 -command "destroy $name"
- pack $name.ok -side bottom -anchor s -pady 1m
-
- frame $name.div2 -relief sunken -bd 1 -height 1m
- pack $name.div2 -side bottom -fill x
-
- text $name.text -relief flat -wrap word -height 0
- $name.text insert end $text
-
- #$name.text tag add title 1.0 1.end
- #$name.text tag configure title -underline true
-
- if {[llength $urls]} {
- $name.text insert end "\nSee Also:\n"
- set i 0
- foreach u $urls {
- global $name.text
-
- set $name.text(url$i:url) [lindex $u 0]
-
- $name.text insert end [lindex $u 1]
- $name.text tag add url$i "current linestart" "current lineend"
- $name.text tag configure url$i -underline true -foreground blue -spacing1 5
-
- helpBind $name.text url$i <Enter> {
- %W configure -cursor hand2
- }
-
- helpBind $name.text url$i <Leave> {
- %W configure -cursor xterm
- }
-
- helpBind $name.text url$i <ButtonPress-1> {
- %W tag configure %T -foreground red
- helpOpenURL [set %W(%T:url)]
- %W tag configure %T -foreground blue
- }
-
- $name.text insert end "\n"
- incr i
- }
- }
-
- $name.text configure -state disabled
-
- scrollbar $name.scroll -bd 2 -width 12
-
- $name.scroll configure -command "$name.text yview"
- $name.text configure -yscrollcommand "$name.scroll set"
-
- pack $name.scroll -side right -fill y
- pack $name.text -padx 2m -pady 2m -anchor n -fill both -expand 1 -side right
-
- frame $name.spacer -height 400p
- pack $name.spacer
- }
-
-