#!/afs/ece/usr/tcl/bin/wish -f

source "[file dirname [info script]]/../aux/teach.tcl"

# Help text.
set Help "" ; append Help {Dialogth -- Add Keyboard Traversal to Tk's Dialog Box

This program adds numbers to Tk's dialog box. Now the 1 key picks the leftmost
button, the 2 key picks the next, and so on. The 0 key picks the default
button.


Widgets of Dialogth

The Teach Button

Click on Teach to start teaching applications, then click on a remote
application to teach it the new dialog procedure.

} $TH_Help {

Bugs / Limitations

None.
(I hope!)
}


proc teach_code {app widget} {
  global TH_Dir
  if {[send $app info procs tk_dialog] != ""} {
    do_cmd $app "rename tk_dialog {}\n" 0}
  include_files $app dialog.tcl
}

# Extends the remote widget
proc extend_app {x y b} {
  if {![which_widget $x $y 1 app widget]} {toggle_grab ; th_beep ; return}
  teach_code $app $widget
  toggle_grab
}


# These bindings only should take effect when historyth does a global grab.
bind all <Any-Button>				"extend_app %X %Y %b"
