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.

103 lines
3.5KB

  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: NoteBook.tcl,v 1.4 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 tixNoteBook widget, which allows
  13. # you to lay out your interface using a "notebook" metaphore
  14. #
  15. proc RunSample {w} {
  16. # We use these options to set the sizes of the subwidgets inside the
  17. # notebook, so that they are well-aligned on the screen.
  18. #
  19. set name [tixOptionName $w]
  20. option add *$name*TixControl*entry.width 10
  21. option add *$name*TixControl*label.width 18
  22. option add *$name*TixControl*label.anchor e
  23. # Create the notebook widget and set its backpagecolor to gray.
  24. # Note that the -backpagecolor option belongs to the "nbframe"
  25. # subwidget.
  26. tixNoteBook $w.nb -ipadx 6 -ipady 6
  27. # $w config -bg gray
  28. # $w.nb subwidget nbframe config -backpagecolor gray
  29. # Create the two tabs on the notebook. The -underline option
  30. # puts a underline on the first character of the labels of the tabs.
  31. # Keyboard accelerators will be defined automatically according
  32. # to the underlined character.
  33. #
  34. $w.nb add hard_disk -label "Hard Disk" -underline 0
  35. $w.nb add network -label "Network" -underline 0
  36. pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
  37. #----------------------------------------
  38. # Create the first page
  39. #----------------------------------------
  40. set f [$w.nb subwidget hard_disk]
  41. # Create two frames: one for the common buttons, one for the
  42. # other widgets
  43. #
  44. frame $f.f
  45. frame $f.common
  46. pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
  47. pack $f.common -side right -padx 2 -pady 2 -fill y
  48. # Create the controls that only belong to this page
  49. #
  50. tixControl $f.f.a -value 12 -label "Access Time: "
  51. tixControl $f.f.w -value 400 -label "Write Throughput: "
  52. tixControl $f.f.r -value 400 -label "Read Throughput: "
  53. tixControl $f.f.c -value 1021 -label "Capacity: "
  54. pack $f.f.a $f.f.w $f.f.r $f.f.c -side top -padx 20 -pady 2
  55. # Create the common buttons
  56. #
  57. CreateCommonButtons $w $f.common
  58. #----------------------------------------
  59. # Create the second page
  60. #----------------------------------------
  61. set f [$w.nb subwidget network]
  62. frame $f.f
  63. frame $f.common
  64. pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
  65. pack $f.common -side right -padx 2 -pady 2 -fill y
  66. tixControl $f.f.a -value 12 -label "Access Time: "
  67. tixControl $f.f.w -value 400 -label "Write Throughput: "
  68. tixControl $f.f.r -value 400 -label "Read Throughput: "
  69. tixControl $f.f.c -value 1021 -label "Capacity: "
  70. tixControl $f.f.u -value 10 -label "Users: "
  71. pack $f.f.a $f.f.w $f.f.r $f.f.c $f.f.u -side top -padx 20 -pady 2
  72. CreateCommonButtons $w $f.common
  73. }
  74. proc CreateCommonButtons {w f} {
  75. button $f.ok -text OK -width 6 -command "destroy $w"
  76. button $f.cancel -text Cancel -width 6 -command "destroy $w"
  77. pack $f.ok $f.cancel -side top -padx 2 -pady 2
  78. }
  79. if {![info exists tix_demo_running]} {
  80. wm withdraw .
  81. set w .demo
  82. toplevel $w; wm transient $w ""
  83. RunSample $w
  84. bind $w <Destroy> {if {"%W" == ".demo"} exit}
  85. }
上海开阖软件有限公司 沪ICP备12045867号-1