home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / incoming / jstools-.6v3 / jstools- / jstools-tk3.6v3.0 / lib / jalert.tcl < prev    next >
Encoding:
Text File  |  1995-02-09  |  1.1 KB  |  38 lines

  1. # jalert.tcl - notification panel
  2. # Copyright 1992-1994 by Jay Sekora.  All rights reserved, except 
  3. # that this file may be freely redistributed in whole or in part 
  4. # for non-profit, noncommercial use.
  5.  
  6. ######################################################################
  7. # j:alert ?options? - alert box
  8. # options include
  9. #   -title (default "Alert")
  10. #   -text (default "Alert!" - not really optional)
  11. ######################################################################
  12.  
  13. proc j:alert { args } {
  14.   j:parse_args {
  15.     {title "Alert"}
  16.     {text "Alert!"}
  17.   }
  18.   set old_focus [j:current_focus]    ;# so we can restore original focus
  19.   toplevel .alert
  20.   wm title .alert $title
  21.   
  22.   message .alert.msg -width 300 -anchor w -text $text
  23.   j:buttonbar .alert.b -default ok -buttons {{ok OK {destroy .alert}}}
  24.   
  25.   pack .alert.msg -side top -fill both -expand yes -padx 10 -pady 10
  26.   pack [j:rule .alert -width 200] -side top -fill x
  27.   pack .alert.b -side bottom -fill both
  28.   
  29.   j:dialogue .alert        ;# position in centre of screen
  30.  
  31.   focus .alert
  32.   j:default_button .alert.b.ok .alert
  33.   grab .alert
  34.   tkwait window .alert
  35.   focus $old_focus
  36. }
  37.