gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.2KB

  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: FileEnt.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
  4. #
  5. # Tix Demostration Program
  6. #
  7. # This sample program is structured in such a way so that it can be
  8. # executed from the Tix demo program "widget": it must have a
  9. # procedure called "RunSample". It should also have the "if" statment
  10. # at the end of this file so that it can be run as a standalone
  11. # program using tixwish.
  12. # This file demonstrates the use of the tixFileEntry widget -- an
  13. # easy of letting the user select a filename
  14. #
  15. proc RunSample {w} {
  16. # Create the tixFileEntry's on the top of the dialog box
  17. #
  18. frame $w.top -border 1 -relief raised
  19. global demo_fent_from demo_fent_to
  20. tixFileEntry $w.top.a -label "Move File From: " \
  21. -variable demo_fent_from \
  22. -options {
  23. entry.width 25
  24. label.width 16
  25. label.underline 10
  26. label.anchor e
  27. }
  28. tixFileEntry $w.top.b -label "To: " \
  29. -variable demo_fent_to \
  30. -options {
  31. entry.width 25
  32. label.underline 0
  33. label.width 16
  34. label.anchor e
  35. }
  36. pack $w.top.a $w.top.b -side top -anchor w -pady 3
  37. # Use a ButtonBox to hold the buttons.
  38. #
  39. tixButtonBox $w.box -orientation horizontal
  40. $w.box add ok -text Ok -underline 0 -command "fent:okcmd $w" \
  41. -width 6
  42. $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
  43. -width 6
  44. pack $w.box -side bottom -fill x
  45. pack $w.top -side top -fill both -expand yes
  46. # Let's set some nice bindings for keyboard accelerators
  47. #
  48. bind $w <Alt-f> "focus $w.top.a"
  49. bind $w <Alt-t> "focus $w.top.b"
  50. bind $w <Alt-o> "[$w.box subwidget ok] invoke; break"
  51. bind $w <Alt-c> "[$w.box subwidget cancel] invoke; break"
  52. }
  53. proc fent:okcmd {w} {
  54. global demo_fent_from demo_fent_to
  55. # tixDemo:Status "You wanted to move file from $demo_fent_from to $demo_fent_to"
  56. destroy $w
  57. }
  58. # This "if" statement makes it possible to run this script file inside or
  59. # outside of the main demo program "widget".
  60. #
  61. if {![info exists tix_demo_running]} {
  62. wm withdraw .
  63. set w .demo
  64. toplevel $w; wm transient $w ""
  65. RunSample $w
  66. bind $w <Destroy> exit
  67. }
上海开阖软件有限公司 沪ICP备12045867号-1