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

  1.  
  2. ViewManager subclass: #TestView
  3.   instanceVariableNames: ''
  4.   classVariableNames: ''
  5.   poolDictionaries: 
  6.     'PMConstants '  !
  7.  
  8.  
  9. !TestView class methods ! !
  10.  
  11.  
  12.  
  13. !TestView methods !
  14.    
  15. myMenu
  16.         "Private - Answer the File menu."
  17.     ^Menu new
  18.         appendItem: '~My Choice' selector: #myMenuMethod ;
  19.       title: '~My Menu'!
  20.   
  21. myMenuMethod
  22.          "This method is activated when 'MyChoice'
  23.           is selected in the pulldown 'My Menu'"
  24.  
  25.          MessageBox
  26.                     titled: 'Gotcha!!!!!!'
  27.                     withText: 'My menu WORKS !!!!!!'
  28.                     style: MbOk | MbIconexclamation.!
  29.   
  30. mySelect: aListBox
  31.  
  32.  
  33.          "This method is activated when a new
  34.           selection in made in listpane"
  35.  
  36.          MessageBox
  37.                     titled: 'Line selected'
  38.                     withText: (aListBox lineAt: aListBox selection)
  39.                     style: MbOk | MbIconexclamation.!
  40.  
  41. myTextList: aListBox
  42.  
  43.       | myCollection |
  44.  
  45.       myCollection := OrderedCollection new.
  46.       myCollection add: 'Row 1';
  47.                    add: 'Row 2';
  48.                    add: 'Row 3'.
  49.       aListBox contents: myCollection.!
  50.    
  51. open
  52.         "Open an window containing a ListBox"
  53.  
  54.  
  55.     self
  56.         owner: self;
  57.         label: 'A TEST';
  58.         yourself.
  59.  
  60.     self addSubpane:
  61.         (ListBox new
  62.             owner: self;
  63.             when: #getContents perform: #myTextList: ;
  64.             when: #select perform: #mySelect:;
  65.             framingBlock: [:box | box]).
  66.  
  67.      self openWindow.
  68.      self menuWindow addMenu: self myMenu owner: self.! !
  69.