#UI_ENHANCEMENT
class: ListSelectionBox
class definition
added:
#clearEntryFieldOnDeselect
#clearEntryFieldOnDeselect:
changed: #selectionChanged
do not clear user's entry, when list gets deselected
--- a/ListSelectionBox.st Sat Jan 16 04:57:07 2016 +0000
+++ b/ListSelectionBox.st Sat Jan 16 13:04:14 2016 +0100
@@ -11,9 +11,11 @@
"
"{ Package: 'stx:libwidg' }"
+"{ NameSpace: Smalltalk }"
+
EnterBox subclass:#ListSelectionBox
instanceVariableNames:'panel list selectionList selectionChangeCallback useIndex
- searchJob'
+ searchJob clearEntryFieldOnDeselect'
classVariableNames:''
poolDictionaries:''
category:'Views-DialogBoxes'
@@ -212,6 +214,22 @@
!ListSelectionBox methodsFor:'accessing-behavior'!
+clearEntryFieldOnDeselect
+ "normally, the entryfield's contents is not cleared,
+ when the list is deselected.
+ This can be changed here."
+
+ ^ clearEntryFieldOnDeselect ? false
+!
+
+clearEntryFieldOnDeselect:aBoolean
+ "normally, the entryfield's contents is not cleared,
+ when the list is deselected.
+ This can be changed here."
+
+ clearEntryFieldOnDeselect := aBoolean.
+!
+
useIndex:aBoolean
aBoolean ifTrue:[
self noEnterField
@@ -481,7 +499,12 @@
"selections in list get forwarded to enterfield"
enterField notNil ifTrue:[
- enterField contents:(selectionList selectionValue)
+ |val|
+
+ val := selectionList selectionValue.
+ (val notEmptyOrNil or:[self clearEntryFieldOnDeselect]) ifTrue:[
+ enterField contents:val
+ ].
].
selectionChangeCallback notNil ifTrue:[
selectionChangeCallback value:selectionList selection
@@ -493,10 +516,10 @@
!ListSelectionBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.63 2014-12-11 17:25:40 cg Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.63 2014-12-11 17:25:40 cg Exp $'
+ ^ '$Header$'
! !