allow delayedMenus on toggles too
authorca
Sat, 12 Oct 2002 18:10:34 +0200
changeset 1623 3fac80dbb0b3
parent 1622 766547778a34
child 1624 b523a5213c34
allow delayedMenus on toggles too
MenuEditor.st
--- a/MenuEditor.st	Wed Oct 09 16:43:54 2002 +0200
+++ b/MenuEditor.st	Sat Oct 12 18:10:34 2002 +0200
@@ -3356,7 +3356,6 @@
               #name: 'indicationLabel'
               #layout: #(#AlignmentOrigin 107 0 138 0 1 0.5)
               #activeHelpKey: #basicsIndication
-              #visibilityChannel: #hasNoDelayedMenuValue
               #resizeForLabel: true
               #adjust: #right
             )
@@ -3364,7 +3363,6 @@
               #name: 'indicationField'
               #layout: #(#LayoutFrame 110 0 127 0 -5 1.0 149 0)
               #activeHelpKey: #basicsIndication
-              #visibilityChannel: #hasNoDelayedMenuValue
               #enableChannel: #indicationEnabled
               #tabable: true
               #model: #indication
@@ -3382,7 +3380,6 @@
               #name: 'choiceLabel'
               #layout: #(#AlignmentOrigin 107 0 163 0 1 0.5)
               #activeHelpKey: #basicsChoice
-              #visibilityChannel: #hasNoDelayedMenuValue
               #translateLabel: true
               #resizeForLabel: true
               #adjust: #right
@@ -3391,7 +3388,6 @@
               #name: 'choiceField'
               #layout: #(#LayoutFrame 110 0 152 0 -5 1.0 174 0)
               #activeHelpKey: #basicsChoice
-              #visibilityChannel: #hasNoDelayedMenuValue
               #enableChannel: #choiceEnabled
               #tabable: true
               #model: #choice
@@ -3409,7 +3405,6 @@
               #name: 'choiceValueLabel'
               #layout: #(#AlignmentOrigin 107 0 188 0 1 0.5)
               #activeHelpKey: #basicsChoiceValue
-              #visibilityChannel: #hasNoDelayedMenuValue
               #translateLabel: true
               #resizeForLabel: true
               #adjust: #right
@@ -3418,7 +3413,6 @@
               #name: 'choiceValueField'
               #layout: #(#LayoutFrame 110 0 177 0 -5 1.0 199 0)
               #activeHelpKey: #basicsChoiceValue
-              #visibilityChannel: #hasNoDelayedMenuValue
               #enableChannel: #choiceValueEnabled
               #tabable: true
               #model: #choiceValue
@@ -3471,7 +3465,7 @@
               #name: 'triggerOnDown'
               #layout: #(#Point 20 313)
               #activeHelpKey: #triggerOnDown
-              #visibilityChannel: #hasNoDelayedMenuValue
+              #enableChannel: #hasNoDelayedMenuValue
               #tabable: true
               #model: #triggerOnDown
               #translateLabel: true
@@ -3536,13 +3530,8 @@
         ^ nil
     ].
     "/ reset values not setable if a delayed menu is configured
-
-    menuItem        choice:nil.
-    menuItem    indication:nil.
-    menuItem   choiceValue:nil.
     menuItem triggerOnDown:false.
-
-    anItem argument:(menuItem argument).
+    anItem        argument:(menuItem argument).
 
     isExpanded := false.
     anItem parent:self.
@@ -3563,15 +3552,30 @@
         menuItem argument:aValue.
       ^ self
     ].
+    aKey == #triggerOnDown ifTrue:[
+        self hasDelayedMenu ifTrue:[
+            menuItem triggerOnDown:false
+        ] ifFalse:[
+            menuItem triggerOnDown:aValue
+        ].
+        ^ self.
+    ].
     super aspectAt:aKey put:aValue.
 !
 
 toAspects:aspects
     "write values to aspects
     "
+    |hasDelayedMenu|
+
     super toAspects:aspects.
 
-    (aspects at:#hasNoDelayedMenuValue) value:(self hasDelayedMenu not).
+    hasDelayedMenu := self hasDelayedMenu.
+    (aspects at:#hasNoDelayedMenuValue) value:(hasDelayedMenu not).
+
+    hasDelayedMenu ifTrue:[
+        (aspects at:#triggerOnDown) value:false
+    ].
 ! !
 
 !MenuEditor::ItemAction methodsFor:'displaying'!
@@ -3610,11 +3614,9 @@
 !MenuEditor::ItemAction methodsFor:'queries - operation'!
 
 canAddDelayedMenu
-    "returns true if a delayed menu can be added;
-     no delayed menu exists and the indication or choice is unspecified
+    "returns true if a delayed menu can be added
     "
-    self hasDelayedMenu ifTrue:[ ^ false ].
-  ^ (menuItem indication isNil and:[menuItem choice isNil])
+    ^ self hasDelayedMenu not
 ! !
 
 !MenuEditor::ItemLinkedMenu class methodsFor:'defaults'!