home *** CD-ROM | disk | FTP | other *** search
/ Chip: Linux Special / CorelLinux_CHIP.iso / VMware / bin / vmware-wizard / lib / htmlButton.tcl < prev    next >
Encoding:
Text File  |  1999-08-24  |  1.2 KB  |  60 lines

  1.  
  2. proc openURL {url} {
  3.     set netscape [Shell_DoesBinaryExist_Prompt {netscape}]
  4.     if {$netscape == ""} {
  5.         DialogWin .error "Help System Error" "Could not find netscape. URLs will not be available." {} 0 OK
  6.         return
  7.     }
  8.     
  9.     if [catch {exec $netscape -remote "openURL($url, vmware-window, raise)" >& /dev/null} err] {
  10.         if [catch {exec $netscape $url >& /dev/null &} err] {
  11.             DialogWin .error "Help System Error" "Can't open $netscape." {} 0 OK
  12.         }
  13.     }
  14. }
  15.  
  16.  
  17. bind HtmlButton <ButtonPress-1> {
  18.     %W configure -fg red
  19.     set %W(active) 1
  20.     set %W(inout) 1
  21. }
  22.  
  23. bind HtmlButton <ButtonRelease-1> {
  24.     %W configure -fg blue
  25.     set %W(active) 0
  26.     if {[set %W(inout)]} {
  27.         openURL [set %W(url)]
  28.     }
  29. }
  30.  
  31. bind HtmlButton <Leave> {
  32.     if {[set %W(active)]} {
  33.         %W configure -fg blue
  34.     }
  35.     set %W(inout) 0
  36. }
  37.  
  38. bind HtmlButton <Enter> {
  39.     if {[set %W(active)]} {
  40.         %W configure -fg red
  41.     }
  42.     set %W(inout) 1
  43. }
  44.  
  45. proc htmlButton {name url text} {
  46.     global $name
  47.  
  48.     label $name -fg blue -cursor hand2 -text $text
  49.  
  50.     bindtags $name "$name HtmlButton . all"
  51.  
  52.     set ${name}(active) 0
  53.     set ${name}(inout) 0
  54.     set ${name}(url) $url
  55.  
  56.     return $name
  57. }
  58.  
  59.  
  60.