PullDMenu.st
changeset 773 de7268eb5575
parent 772 9994f479be43
child 779 2a63af1579fa
--- a/PullDMenu.st	Fri Jul 05 11:20:56 1996 +0200
+++ b/PullDMenu.st	Fri Jul 05 11:43:37 1996 +0200
@@ -434,6 +434,10 @@
         selectors := ((selectors copyTo:idx) copyWith:selector) , (selectors copyFrom:idx+1).
     ].
 
+    shown ifTrue:[
+        self redraw
+    ]
+
     "
      |top m|
 
@@ -450,7 +454,7 @@
      top open
     "
 
-    "Modified: 5.6.1996 / 16:45:55 / cg"
+    "Modified: 5.7.1996 / 11:40:47 / cg"
 !
 
 add:label selector:selector before:indexOrString
@@ -477,6 +481,10 @@
         selectors := ((selectors copyTo:idx-1) copyWith:selector) , (selectors copyFrom:idx).
     ].
 
+    shown ifTrue:[
+        self redraw
+    ]
+
     "
      |top m|
 
@@ -498,7 +506,7 @@
      top open
     "
 
-    "Modified: 5.7.1996 / 11:20:23 / cg"
+    "Modified: 5.7.1996 / 11:40:55 / cg"
 !
 
 at:aString putLabels:labels selector:selector args:args receiver:anObject
@@ -658,6 +666,45 @@
     ]
 !
 
+remove:indexOrString
+    "remove the menu, indexOrString."
+
+    |idx|
+
+    idx := self indexOf:indexOrString.
+    idx == 0 ifTrue:[^ self].
+
+    menus removeIndex:idx.
+    titles removeIndex:idx.
+    selectors removeIndex:idx.
+
+    shown ifTrue:[
+        self clear.
+        self redraw
+    ]
+
+    "
+     |top m|
+
+     top := StandardSystemView new extent:300@200.
+     m := PullDownMenu in:top.
+     m labels:#('file' 'edit').
+     m selectors:#(file #edit).
+     top open.
+
+     Delay waitForSeconds:3.
+     m add:'help' selector:#help after:#file.
+     m at:#help putMenu:(MenuView labels:#('foo' 'bar')
+                               selectors:#(foo bar)
+                                receiver:nil).
+
+     Delay waitForSeconds:3.
+     m remove:'help'
+    "
+
+    "Modified: 5.7.1996 / 11:43:08 / cg"
+!
+
 selectors
     "return the menu-selectors"
 
@@ -1602,5 +1649,5 @@
 !PullDownMenu  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.63 1996-07-05 09:20:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/PullDMenu.st,v 1.64 1996-07-05 09:43:37 cg Exp $'
 ! !