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

  1.  
  2. ViewManager subclass: #TestButtonView
  3.   instanceVariableNames: ''
  4.   classVariableNames: ''
  5.   poolDictionaries: 
  6.     'PMConstants '    !
  7.  
  8.  
  9. !TestButtonView class methods ! !
  10.  
  11.  
  12.  
  13. !TestButtonView methods !
  14.    
  15. cancel: aPane
  16.         "Private-Inform the event that Cancel button is pushed 
  17.           via TranscriptWindow"
  18.    Transcript nextPutAll:'Cancel button was pushed ';
  19.                      cr.!
  20.    
  21. ok: aPane
  22.         "Private-Inform the event that OK button is pushed 
  23.           via TranscriptWindow"
  24.    Transcript nextPutAll:'OK button was pushed ';
  25.                      cr.!
  26.    
  27. open
  28.         "Private - Open the window with 2 push buttons"
  29.     | lineHeight charWidth charHeight |
  30.  
  31.     charHeight := SysFontHeight.
  32.     charWidth := SysFontWidth. 
  33.     lineHeight := charHeight + 5. 
  34.  
  35.     self
  36.         owner: self;
  37.         label: 'A TEST';
  38.         yourself.
  39.  
  40.         self addSubpane:
  41.         (Button new
  42.             contents: 'OK';
  43.             defaultPushButton;
  44.             when: #clicked perform: #ok:;
  45.             framingBlock: [:box |
  46.                 (box leftBottom rightAndUp: (charWidth * 15) @ (lineHeight * 2))
  47.                     extent: (charWidth * 9) @ lineHeight ] ).
  48.  
  49.     self addSubpane:
  50.         (Button new
  51.             contents: 'Cancel';
  52.             owner: self;
  53.             when: #clicked perform: #cancel:;
  54.             framingBlock: [:box |
  55.                 (box leftBottom rightAndUp: (charWidth * 30) @ (lineHeight * 2))
  56.                     extent: (charWidth * 9) @ lineHeight ] ).
  57.  
  58.     self openWindow.! !
  59.