changed: #accept:index:toggle:receiver:
fix compatibilitiy issue introcuded by Jan's asMenu
MenuPanel did not support array (sel, args) as item value,
which is needed for example by sort-menu in EditTextView.
--- a/MenuPanel.st Thu Feb 16 08:45:39 2012 +0100
+++ b/MenuPanel.st Tue Mar 06 14:50:29 2012 +0100
@@ -1014,7 +1014,7 @@
argument := aState ? anItem
].
- selectorOrBlock isSymbol ifFalse:[
+ (selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[
"/ a valueHolder or block
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
^ self "/ ^ selectorOrBlock
@@ -1054,30 +1054,37 @@
isValueModel ifTrue:[
rec value:selectorOrBlock
] ifFalse:[
- arg2 := self.
-
- "/ support for ST80 style applications
- "/ (expecting the message to go to the application
- "/ if not understood by the view)
- "/ These expect the controller to be passed as argument.
- "/ sigh.
-
- (rec isView
- and:[(rec respondsTo:selectorOrBlock) not
- and:[(app := rec application) ~~ rec
- and:[app notNil]]]) ifTrue:[
- arg2 := rec controller. "/ the Views controller
- rec := app.
- ].
-
- (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
- args := nil
+ selectorOrBlock isArray ifTrue:[
+ "/ a hack !!!!!! Must be compatible to old MenuView
+ args := selectorOrBlock copyFrom:2.
+ selectorOrBlock := selectorOrBlock first.
] ifFalse:[
- numArgs == 1 ifTrue:[
- args := Array with:argument
+
+ arg2 := self.
+
+ "/ support for ST80 style applications
+ "/ (expecting the message to go to the application
+ "/ if not understood by the view)
+ "/ These expect the controller to be passed as argument.
+ "/ sigh.
+
+ (rec isView
+ and:[(rec respondsTo:selectorOrBlock) not
+ and:[(app := rec application) ~~ rec
+ and:[app notNil]]]) ifTrue:[
+ arg2 := rec controller. "/ the Views controller
+ rec := app.
+ ].
+
+ (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
+ args := nil
] ifFalse:[
- args := Array with:argument with:arg2
- ]
+ numArgs == 1 ifTrue:[
+ args := Array with:argument
+ ] ifFalse:[
+ args := Array with:argument with:arg2
+ ]
+ ].
].
fallBack :=
@@ -1105,7 +1112,7 @@
hasPerformed := true.
^ self "/ ^ selectorOrBlock
- "Modified: / 29-06-2011 / 16:22:08 / cg"
+ "Modified: / 06-03-2012 / 14:49:00 / cg"
!
acceptItem:anItemOrNil inMenu:aMenu
@@ -6022,9 +6029,11 @@
!
itemValue
- "gets the items value"
+ "gets the item's value"
^ menuItem itemValue
+
+ "Modified (comment): / 06-03-2012 / 14:41:27 / cg"
!
itemValue:aValue
@@ -6279,10 +6288,12 @@
!
value
- "gets the items value
+ "gets the item's value
Left here for ST80 compatibility - value is a bad name"
^ menuItem itemValue
+
+ "Modified (comment): / 06-03-2012 / 14:41:23 / cg"
!
value:aValue
@@ -8622,11 +8633,11 @@
!MenuPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.534 2012-02-15 21:32:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.535 2012-03-06 13:50:29 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.534 2012-02-15 21:32:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.535 2012-03-06 13:50:29 cg Exp $'
! !
MenuPanel initialize!