home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Demos / Widget / Wtext.stklos < prev    next >
Encoding:
Text File  |  1995-08-23  |  2.9 KB  |  66 lines

  1. ;;;;
  2. ;;;; STk adaptation of the Tk widget demo.
  3. ;;;;
  4. ;;;; This demonstration script creates a text widget that describes
  5. ;;;; the basic editing functions.
  6. ;;;;
  7. (require "Tk-classes")
  8.  
  9. (define (demo-text)
  10.   (let ((w (make-demo-toplevel "text"
  11.                    "Text Demonstration - Basic Facilities"
  12.                    "")))
  13.     (pack (make <Text> :relief "sunken"
  14.                :parent w
  15.                :border-width 2 
  16.                :set-grid #t
  17.                :height 30
  18.                :value 
  19. "This window is a text widget.  It displays one or more lines of text
  20. and allows you to edit the text.  Here is a summary of the things you
  21. can do to a text widget:
  22.  
  23. 1. Scrolling. Use the scrollbar to adjust the view in the text window.
  24.  
  25. 2. Scanning. Press mouse button 2 in the text window and drag up or down.
  26. This will drag the text at high speed to allow you to scan its contents.
  27.  
  28. 3. Insert text. Press mouse button 1 to set the insertion cursor, then
  29. type text.  What you type will be added to the widget.
  30.  
  31. 4. Select. Press mouse button 1 and drag to select a range of characters.
  32. Once you've released the button, you can adjust the selection by pressing
  33. button 1 with the shift key down.  This will reset the end of the
  34. selection nearest the mouse cursor and you can drag that end of the
  35. selection by dragging the mouse before releasing the mouse button.
  36. You can double-click to select whole words or triple-click to select
  37. whole lines.
  38.  
  39. 5. Delete and replace. To delete text, select the characters you'd like
  40. to delete and type Backspace or Delete.  Alternatively, you can type new
  41. text, in which case it will replace the selected text.
  42.  
  43. 6. Copy the selection. To copy the selection into this window, select
  44. what you want to copy (either here or in another application), then
  45. click button 2 to copy the selection to the point of the mouse cursor.
  46.  
  47. 7. Edit.  Text widgets support the standard Motif editing characters
  48. plus many Emacs editing characters.  Backspace and Control-h erase the
  49. character to the left of the insertion cursor.  Delete and Control-d
  50. erase the character to the right of the insertion cursor.  Meta-backspace
  51. deletes the word to the left of the insertion cursor, and Meta-d deletes
  52. the word to the right of the insertion cursor.  Control-k deletes from
  53. the insertion cursor to the end of the line, or it deletes the newline
  54. character if that is the only thing left on the line.  Control-o opens
  55. a new line by inserting a newline character to the right of the insertion
  56. cursor.  Control-t transposes the two characters on either side of the
  57. insertion cursor.
  58.  
  59. 7. Resize the window.  This widget has been configured with the \"set-grid\"
  60. option on, so that if you resize the window it will always resize to an
  61. even number of characters high and wide.  Also, if you make the window
  62. narrow you can see that long lines automatically wrap around onto
  63. additional lines so that all the information is always visible.")
  64.     :side "top"
  65.     :padx 5
  66.     :fill "both")))