Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!howland.erols.net!blackbush.xlink.net!ka.sub.net!News.Saar.DE!dacos-gate.saarlink.de!usenet
From: Kai Ibach <kai.ibach@sap-ag.de>
Subject: VW25: No update of a combobox upon selection (when the choice list has been changed).
Content-Type: text/plain; charset=us-ascii
Sender: usenet@dacos-gate.saarlink.de
Content-Transfer-Encoding: 7bit
Organization: DACOS Software GmbH
Message-ID: <32F7CEC7.119D@sap-ag.de>
X-Mailer: Mozilla 2.02 (Win16; I)
Mime-Version: 1.0
Cc: kai.ibach@sap-ag.de
Date: Wed, 5 Feb 1997 00:05:27 GMT
Lines: 60

Hello,
I am facing the following problem: 
The selection of an entry within a combobox's choice list doesn't always display
the (new) value in the box - provided the choice list has been modified in the
meantime. To be more specific:


1. create a simple combobox and
   let the choice list look like:

initialize

	| aList |
	aList := List new.
	aList add: 'A'.
	aList add: 'B'.
	aList add: 'C'.
	boxChoices := aList asValue

2. Select an arbitrary entry from the list of choices.
   Suppose that it is the kth. element of the list. 

3. Replace the choice list, eg.:

updateComboboxList
	
	| list |
	list := List new.
	list addFirst: '1'.
	list addFirst: '2'.
	list addFirst: '3'.
	boxChoices value: list.


4. Now use the mouse (don't hit cr) to select the (new) entry at the SAME(!!) position k.
   Although we have just picked a new value the contents of the combo box
   remains unchanged. Apparently this is due to the associated lastSelectionIndex 
   which has not been reset despite the recent list's modification.

	*** This suggests to be a bug, doesn't it? ***
	    How am I supposed to redefine a choice list?

   Note that the following lines do the job. However this appears to be fairly dirty 
   so that I should appreciate your help very much.

	| wrapper |
	wrapper := self componentAt: #box.
	((wrapper notNil) and: [wrapper widget isKindOf: ComboBoxView])
		ifTrue:[	wrapper widget menuButton lastSelectionIndex: 0.
	].
 

Thanks a lot for your assistance,
with best regards,
			Kai

-- 
Kai Ibach, kai.ibach@sap-ag.de
DACOS Software GmbH, Logistik
Voice +49 6894 981-366, Fax +49 6894 981-199
