Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo box just won't keep hand entered text
Message
 
 
À
07/07/2006 11:02:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00987581
Message ID:
01134478
Vues:
23
>
>What if the user enters the text and them presses < Enter >? Does it stay then?

Yes, with the code from Marcia it stays there. If I then go back to the combobox and re-type the value, both values stay in the list. This is untill I saved the data and requery combobox using actual tables rather than this select.

I guess there is no simple way around it (unless keeping all new entries in array ( or additional cursor) and deleting them from this cursor when a new value typed over the previous one). I'm wondering if this idea worth implementing or these bad new entries are not a big deal.

(The other idea is always replace the last physical record in the cursor with the new value)

What do you think?

UPDATE. Ok, while I was waiting your reply I went ahead and implemented this:

Init of the combo:
dodefault()
this.AddProperty('lValueInserted',.f.) 
this.AddProperty('cValueInserted',"")
valid of the combo:
local lcValue, lcOldValue
lcValue = this.displayvalue
if not empty(m.lcValue ) and this.listindex = 0
*** The user typed in something that is not in the combo's
*** list. Take action here to add the entry
	if this.lValueInserted
		lcOldValue = this.cValueInserted
		replace cShort_Name with m.lcValue for cShort_Name == m.lcOldValue in curShortNames
	else	 
		insert into curShortNames (cShort_Name ) values (m.lcValue)
	endif	
	this.requery()
	this.value = m.lcValue	
	this.lValueInserted = .t.
	this.cValueInserted = m.lcValue
endif
this.parent.chkDefault_Carrier.enabled = not empty(m.lcValue)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform