added a hook for the menu-select-action
authorClaus Gittinger <cg@exept.de>
Mon, 16 Oct 2006 11:12:19 +0200
changeset 3124 3060c3f4246d
parent 3123 8912a9a3bc01
child 3125 25a0bdbe879a
added a hook for the menu-select-action
ComboBoxView.st
--- a/ComboBoxView.st	Fri Oct 13 13:01:49 2006 +0200
+++ b/ComboBoxView.st	Mon Oct 16 11:12:19 2006 +0200
@@ -9,12 +9,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
-
 "{ Package: 'stx:libwidg2' }"
 
 ComboView subclass:#ComboBoxView
-	instanceVariableNames:''
+	instanceVariableNames:'menuSelectAction'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Views-Interactors'
@@ -154,6 +152,12 @@
 
     "Created: 9.2.1996 / 20:18:03 / cg"
     "Modified: 28.2.1996 / 15:10:50 / cg"
+!
+
+menuSelectAction:aBlock
+    menuSelectAction := aBlock
+
+    "Created: / 15-10-2006 / 15:10:25 / cg"
 ! !
 
 !ComboBoxView methodsFor:'accessing-mvc'!
@@ -226,6 +230,8 @@
     "
     self delegate:(KeyboardForwarder toView:field).
 
+    menuSelectAction := [:menuValue | field contents:menuValue].
+
     "
      |b|
 
@@ -234,8 +240,8 @@
      b open
     "
 
-    "Created: 28.2.1996 / 15:07:51 / cg"
-    "Modified: 26.2.1997 / 19:44:13 / cg"
+    "Created: / 28-02-1996 / 15:07:51 / cg"
+    "Modified: / 15-10-2006 / 15:19:18 / cg"
 ! !
 
 !ComboBoxView methodsFor:'private'!
@@ -260,6 +266,8 @@
 !ComboBoxView methodsFor:'user interaction'!
 
 fieldLeft
+    "the edit field was left (via cursor keys or focus change)"
+
     field acceptOnLeave ifTrue:[
         field accept.
         action notNil ifTrue:[
@@ -268,28 +276,31 @@
 
     ].
 
-    "Modified: 26.2.1997 / 19:38:24 / cg"
-    "Created: 26.2.1997 / 19:42:30 / cg"
+    "Created: / 26-02-1997 / 19:42:30 / cg"
+    "Modified: / 15-10-2006 / 15:20:14 / cg"
 !
 
 select:index
+    "a menu item (index) was selected"
+
     |what|
 
+    pullDownButton turnOff.
+
     what := list at:index.
-    field contents:what.
+
+    menuSelectAction value:what.
     field accept.
-    pullDownButton turnOff.
-
     action notNil ifTrue:[
         action value:what
     ].
 
-    "Modified: 26.2.1997 / 19:38:24 / cg"
-    "Created: 28.2.1997 / 14:01:53 / cg"
+    "Created: / 28-02-1997 / 14:01:53 / cg"
+    "Modified: / 15-10-2006 / 15:19:53 / cg"
 ! !
 
 !ComboBoxView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ComboBoxView.st,v 1.27 2003-11-20 16:15:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ComboBoxView.st,v 1.28 2006-10-16 09:12:19 cg Exp $'
 ! !