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.

86 lines
2.7KB

  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: LabFrame.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 tixLabelFrame widget -- a frame that
  13. # come with a label at its side. It looks nifty when you use the set the
  14. # -labelside option to "acrosstop". Note that a lot of Tix widgets, such
  15. # as tixComboBox or tixControl, have the -labelside and -label options. So
  16. # you can use these options to achieve the same effect as in this file
  17. #
  18. proc RunSample {w} {
  19. # Create the radiobuttons at the top of the dialog box, put them
  20. # inside two tixLabelFrames:
  21. #
  22. frame $w.top -border 1 -relief raised
  23. tixLabelFrame $w.top.a -label Font: -labelside acrosstop -options {
  24. label.padX 5
  25. }
  26. tixLabelFrame $w.top.b -label Size: -labelside acrosstop -options {
  27. label.padX 5
  28. }
  29. pack $w.top.a $w.top.b -side left -expand yes -fill both
  30. # Create the radiobuttons inside the left frame.
  31. #
  32. # [Hint] You *must* create the new widgets inside the "frame"
  33. # subwidget, *not* as immediate children of $w.top.a!
  34. #
  35. set f [$w.top.a subwidget frame]
  36. foreach color {Red Green Blue Yellow Orange Purple} {
  37. set lower [string tolower $color]
  38. radiobutton $f.$lower -text $color -variable demo_color \
  39. -relief flat -value $lower -bd 2 -pady 0 -width 7 -anchor w
  40. pack $f.$lower -side top -pady 0 -anchor w -padx 6
  41. }
  42. # Create the radiobuttons inside the right frame.
  43. #
  44. set f [$w.top.b subwidget frame]
  45. foreach point {8 10 12 14 18 24} {
  46. set lower [string tolower $point]
  47. radiobutton $f.$lower -text $point -variable demo_point \
  48. -relief flat -value $lower -bd 2 -pady 0 -width 4 -anchor w
  49. pack $f.$lower -side top -pady 0 -anchor w -padx 8
  50. }
  51. # Use a ButtonBox to hold the buttons.
  52. #
  53. tixButtonBox $w.box -orientation horizontal
  54. $w.box add ok -text Ok -underline 0 -command "labf:okcmd $w" \
  55. -width 6
  56. $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
  57. -width 6
  58. pack $w.box -side bottom -fill x
  59. pack $w.top -side top -fill both -expand yes
  60. }
  61. proc labf:okcmd {w} {
  62. destroy $w
  63. }
  64. # This "if" statement makes it possible to run this script file inside or
  65. # outside of the main demo program "widget".
  66. #
  67. if {![info exists tix_demo_running]} {
  68. wm withdraw .
  69. set w .demo
  70. toplevel $w; wm transient $w ""
  71. RunSample $w
  72. bind $w <Destroy> exit
  73. }
上海开阖软件有限公司 沪ICP备12045867号-1