# HG changeset patch # User Claus Gittinger # Date 1160989939 -7200 # Node ID 3060c3f4246db7da7799ab504a041b7f9fee43f3 # Parent 8912a9a3bc01eb0d239665065247490d8d8dd092 added a hook for the menu-select-action diff -r 8912a9a3bc01 -r 3060c3f4246d 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 $' ! !