FileDlg.tcl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: FileDlg.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
  4. #
  5. # FileDlg.tcl --
  6. #
  7. # Implements the File Selection Dialog widget.
  8. #
  9. # Copyright (c) 1993-1999 Ioi Kim Lam.
  10. # Copyright (c) 2000-2001 Tix Project Group.
  11. #
  12. # See the file "license.terms" for information on usage and redistribution
  13. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  14. #
  15. tixWidgetClass tixFileSelectDialog {
  16. -classname TixFileSelectDialog
  17. -superclass tixStdDialogShell
  18. -method {
  19. }
  20. -flag {
  21. -command
  22. }
  23. -configspec {
  24. {-command command Command ""}
  25. {-title title Title "Select A File"}
  26. }
  27. }
  28. proc tixFileSelectDialog:ConstructTopFrame {w frame} {
  29. upvar #0 $w data
  30. tixChainMethod $w ConstructTopFrame $frame
  31. set data(w:fsbox) [tixFileSelectBox $frame.fsbox \
  32. -command [list tixFileSelectDialog:Invoke $w]]
  33. pack $data(w:fsbox) -expand yes -fill both
  34. }
  35. proc tixFileSelectDialog:SetBindings {w} {
  36. upvar #0 $w data
  37. tixChainMethod $w SetBindings
  38. $data(w:btns) subwidget ok config -command "$data(w:fsbox) invoke" \
  39. -underline 0
  40. $data(w:btns) subwidget apply config -command "$data(w:fsbox) filter" \
  41. -text Filter -underline 0
  42. $data(w:btns) subwidget cancel config -command "wm withdraw $w" \
  43. -underline 0
  44. $data(w:btns) subwidget help config -underline 0
  45. bind $w <Alt-Key-l> "focus [$data(w:fsbox) subwidget filelist]"
  46. bind $w <Alt-Key-d> "focus [$data(w:fsbox) subwidget dirlist]"
  47. bind $w <Alt-Key-s> "focus [$data(w:fsbox) subwidget selection]"
  48. bind $w <Alt-Key-t> "focus [$data(w:fsbox) subwidget filter]"
  49. bind $w <Alt-Key-o> "tkButtonInvoke [$data(w:btns) subwidget ok]"
  50. bind $w <Alt-Key-f> "tkButtonInvoke [$data(w:btns) subwidget apply]"
  51. bind $w <Alt-Key-c> "tkButtonInvoke [$data(w:btns) subwidget cancel]"
  52. bind $w <Alt-Key-h> "tkButtonInvoke [$data(w:btns) subwidget help]"
  53. }
  54. proc tixFileSelectDialog:Invoke {w filename} {
  55. upvar #0 $w data
  56. wm withdraw $w
  57. if {$data(-command) != ""} {
  58. set bind(specs) "%V"
  59. set bind(%V) $filename
  60. tixEvalCmdBinding $w $data(-command) bind $filename
  61. }
  62. }