added example for menuPerformer:
authorClaus Gittinger <cg@exept.de>
Thu, 07 Mar 1996 19:46:39 +0100
changeset 494 ce6292172214
parent 493 64ac6d6270f6
child 495 d993f23ea658
added example for menuPerformer:
ListView.st
--- a/ListView.st	Thu Mar 07 17:53:31 1996 +0100
+++ b/ListView.st	Thu Mar 07 19:46:39 1996 +0100
@@ -751,16 +751,45 @@
      Can be changed with #menuPerformer:"
 
     menuPerformer notNil ifTrue:[
-	^ menuPerformer
+        ^ menuPerformer
     ].
     ^ super menuPerformer
 
+    "Modified: 7.3.1996 / 18:24:20 / cg"
 !
 
 menuPerformer:anObject
-    "change the one that does the menu actions."
+    "change the one that does the menu actions.
+     See the comment in SimpleView>>activateMenu on who gets the menus
+     message."
 
     menuPerformer := anObject
+
+    "
+     |top textV plug|
+
+     plug := Plug new.
+     plug respondTo:#textMenu
+               with:[ |m|
+                        m := PopUpMenu
+                                  labels:#('copy' 'foo' '-' 'others')
+                                  selectors:#(copySelection foo nil others).
+                        m subMenuAt:#others
+                                put:(PopUpMenu 
+                                        labels:#('bar' 'goto')
+                                        selectors:#(bar gotoLine))        
+                    ].
+
+     top := StandardSystemView new.
+     top extent:300@300.
+
+     textV := TextView origin:0.0@0.0 corner:1.0@1.0 in:top.
+     textV menuHolder:plug; menuMessage:#textMenu; menuPerformer:plug.
+     textV contents:'hello world'.
+     top open.
+    "
+
+    "Modified: 7.3.1996 / 19:04:08 / cg"
 !
 
 on:aModel aspect:aspectSymbol
@@ -2935,5 +2964,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.73 1996-03-01 19:23:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.74 1996-03-07 18:46:39 cg Exp $'
 ! !