README 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. sppdgTcllib/console/README
  2. console package
  3. This tcl library provides the 'console' package for use within
  4. applications.
  5. It is often nice to be able to open a console window in your
  6. application to give users access to a log window and/or to give
  7. programmers the ability to debug applications on the fly. You can
  8. either look at the results of commands (puts output is captured) or
  9. type commands directly into the interpreter.
  10. Long, long ago, Jeff Hobbs published a Console widget, based on his
  11. tkcon work and the 'widget' package. But this has not been updated
  12. and doesn't work too well. Note that 'package require Console' (with
  13. a capital C) gets you the Hobbs widget. Use lowercase for this
  14. package.
  15. This alternative package wraps around the (more updated and complete)
  16. tkcon application. This is an excellent console application in its
  17. own rithe, and can be invoked as a componet of another application, if
  18. you know all the secret internal bits to set.
  19. SYNOPSIS
  20. --------
  21. package require console
  22. console::create ?options?
  23. console::show
  24. console::hide
  25. COMMANDS:
  26. ---------
  27. console::create ?options?
  28. Create the console window. This must be a toplevel window, and cannot
  29. be a widget to be packed into another interface. Each option requires
  30. a value.
  31. console::show
  32. Shows (deiconifies) the console window. Sets the -variable to "1".
  33. console::hide
  34. Hides (withdraws) the console window. Sets the -variable to "0"
  35. OPTIONS
  36. -------
  37. Options control the behavior of the console. You can't change 'em
  38. once created.
  39. -showOnStartup <value>
  40. If value is "1", the console is shown when created. If the value is
  41. "0", then the console is created in a withdrawn state. The default is
  42. 0.
  43. -root <windowName>
  44. Root window name for the console. This must be a toplevel, and it
  45. must not yet exist. Default is .console.
  46. -protocol <script>
  47. The script code is assigned to the console window's WM_DELETE_WINDOW
  48. protocol (see [wm protocol]). This script is executed when the user
  49. clicks on the [X] button on the console window. The default script is
  50. {console::hide}, which just hides the console window.
  51. -showMenu <value>
  52. If value is "1", then the console comes with tkCon's menu bar. If
  53. value is "0", then the window appears without any menu bar. The
  54. default is 0.
  55. -title <string>
  56. Sets the window title text on the console window's title bar. The
  57. default is "Command Console".
  58. -variable <varname>
  59. Associates the show/hiddent state of the console window with the
  60. specified variable. The default is no variable. But if a variable is
  61. specified, then it will be set to 0 or 1 whenever the console is
  62. hidden or shown, respectively. A trace is set on the variable, so
  63. that if it changes to 0 or 1, the console is hidden or shown. This is
  64. handy if you put a checkbutton on your gui, and assign a variable.
  65. EXAMPLES
  66. --------
  67. See the file console_demo.tcl for a small application based on the
  68. BWidget toolkit which illustrates menu control of the console.
  69. package require Tk
  70. package require console
  71. menu .menu
  72. . configure -menu .menu
  73. menu .menu.view
  74. .menu add cascade -label "View" -menu .menu.view
  75. .menu.view add checkbutton -label "Console" -variable ::showConsole
  76. console::create -title "My App Console" -variable ::showConsole