home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / misc / wexmast / wtext.pro < prev    next >
Encoding:
Text File  |  1997-07-08  |  2.0 KB  |  66 lines

  1. ; $Id: wtext.pro,v 1.3 1997/01/15 04:29:15 ali Exp $
  2. ;
  3. ; Copyright (c) 1993-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. ; This is the code to create simple text widgets. Text widgets
  7. ; come in two varieties: editable and non-editable. The VALUE of
  8. ; a text widget is equal to the text string displayed in the
  9. ; text widget.
  10.  
  11. ; For an example of text widgets in 'action' see
  12. ; the procedure WORLDROT.PRO available from the 'Simple Widget
  13. ; Examples' widget by selecting 'World Rotation Tool'.
  14.  
  15.  
  16. PRO wtext_event, event
  17.  
  18. ; This event handler for the example text widgets
  19. ; does not really do anything. It's just here to remind
  20. ; you that you generally need an event handler when
  21. ; you are programming widgets.
  22.  
  23. ; For this example, we aren't doing anything with either
  24. ; of the text widgets.
  25.  
  26. ; Text widgets can, however, have
  27. ; USER VALUES so you could use a CASE statement to execute some IDL
  28. ; commands if a text widget were manipulated. You could also use the
  29. ; GET_VALUE keyword to the WIDGET_CONTROL routine to return
  30. ; the text string currently present in a text widget.
  31.  
  32. END
  33.  
  34.  
  35. PRO wtext, GROUP = GROUP
  36.  
  37. ; This procedure creates 2 text widgets.
  38. ; One is editable and the other is not.
  39.  
  40. base = WIDGET_BASE(TITLE = 'Example Text Widgets', $    ;The title for the base. 
  41.            XSIZE = 500, $            ;Make the base really wide.
  42.            /COLUMN)                ;Organize subsequent
  43.                             ;widgets into columns.
  44.  
  45. ; The next two commands create two text widgets.
  46. ; The first is editable, the second is not:
  47.  
  48. text1 = WIDGET_TEXT(base, $        ;This widget belongs to 'base'.
  49.     VALUE = 'This is an editable text widget. Go ahead and edit this text field.', $
  50.     /EDITABLE, $    ;Make it editable.
  51.     YSIZE = 1, $ 
  52.     /FRAME)        ;Put a frame around it.
  53.  
  54. text2 = WIDGET_TEXT(base, $        ;This widget belongs to 'base'.
  55.     VALUE = 'This text widget cannot be edited.', $
  56.     YSIZE = 1, $
  57.     /FRAME)        ;Put a frame around it.
  58.  
  59. ; Realize the widgets:
  60. WIDGET_CONTROL, base, /REALIZE
  61.  
  62. ; Hand off to the XMANAGER:
  63. XMANAGER, 'wtext', base, GROUP_LEADER = GROUP, /NO_BLOCK
  64.  
  65. END
  66.