home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / RB3641.ZIP / EX1 / TESTENT.CLS < prev    next >
Text File  |  1991-12-06  |  1KB  |  56 lines

  1.  
  2. ViewManager subclass: #TestEntryFieldView
  3.   instanceVariableNames: 
  4.     'myEntryField '
  5.   classVariableNames: ''
  6.   poolDictionaries: 
  7.     'PMConstants ' !
  8.  
  9.  
  10. !TestEntryFieldView class methods ! !
  11.  
  12.  
  13.  
  14. !TestEntryFieldView methods !
  15.    
  16. close:topPane
  17.  
  18.    " Private-Close TopPane. Before do it, get the contents
  19.       from the EntryField and display it on the TranscriptWindow.
  20.       And clear the contents of the EntryField."
  21.  
  22.    Transcript nextPutAll:'myEntryField contents was ',
  23.                                        (myEntryField contents)  ;
  24.                                        cr. 
  25.    myEntryField contents: ''.
  26.    self close!
  27.    
  28. myEntryField: aPane
  29.         "Private-Display a text on the entryfield"
  30.  
  31.     aPane contents: 'This is an entryfield'.!
  32.    
  33. open 
  34.         "Private - Open the  window with an entryfield "
  35.     | lineHeight charWidth charHeight |
  36.  
  37.     charHeight := SysFontHeight.
  38.     charWidth := SysFontWidth. 
  39.     lineHeight := charHeight + 5. 
  40.  
  41.     self
  42.         owner: self;
  43.         label: 'A TEST';
  44.         yourself.
  45.      self when: #close perform: #close: . 
  46.  
  47.     self addSubpane:
  48.         (myEntryField:= EntryField new
  49.             "contents: 'This is an entryfield';"
  50.             when: #getContents perform: #myEntryField:;
  51.             framingBlock: [:box |
  52.                 (box leftBottom rightAndUp: (charWidth * 2) @ (lineHeight * 2))
  53.                     extent: (charWidth * 40 ) @ (charHeight ) ]).
  54.  
  55.     self openWindow.! !
  56.