SText.tcl 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: SText.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 tixScrolledText widget.
  13. #
  14. proc RunSample {w} {
  15. # We create the frame and the ScrolledText widget
  16. # at the top of the dialog box
  17. #
  18. frame $w.top -relief raised -bd 1
  19. # Create a Scrolled Text widget.
  20. #
  21. tixScrolledText $w.top.a
  22. pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
  23. # Use a ButtonBox to hold the buttons.
  24. #
  25. tixButtonBox $w.box -orientation horizontal
  26. $w.box add ok -text Ok -underline 0 -command "destroy $w" \
  27. -width 6
  28. $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
  29. -width 6
  30. pack $w.box -side bottom -fill x
  31. pack $w.top -side top -fill both -expand yes
  32. # Put the junk inside the text subwidget of the ScrolledText widget
  33. #
  34. $w.top.a subwidget text insert end {
  35. Mon, 19 Jun 1995 11:39:52 comp.lang.tcl Thread 34 of 220
  36. Lines 353 A new way to put text and bitmaps together
  37. ioi@xpi.com Ioi K. Lam at Expert Interface Technologies
  38. Hi,
  39. I have implemented a new image type called "compound". It allows you
  40. to glue together a bunch of bitmaps, images and text strings together
  41. to form a bigger image. Then you can use this image with widgets that
  42. support the -image option. This way you can display very fancy stuffs
  43. in your GUI. For example, you can display a text string string
  44. together with a bitmap, at the same time, inside a TK button widget. A
  45. screenshot of compound images can be found at the bottom of this page:
  46. http://www.xpi.com/tix/screenshot.html
  47. You can also you is in other places such as putting fancy bitmap+text
  48. in menus, tabs of tixNoteBook widgets, etc. This feature will be
  49. included in the next release of Tix (4.0b1). Count on it to make jazzy
  50. interfaces!}
  51. }
  52. # This "if" statement makes it possible to run this script file inside or
  53. # outside of the main demo program "widget".
  54. #
  55. if {![info exists tix_demo_running]} {
  56. wm withdraw .
  57. set w .demo
  58. toplevel $w; wm transient $w ""
  59. RunSample $w
  60. bind $w <Destroy> exit
  61. }