Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cbos again...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00121448
Message ID:
00121468
Vues:
12
>My client wants to enter a value in a cbo that is not in the rowsource list, ...and not have it in the list in the future. So far the bahavior I'm seeing is you lose the value when the cbo loses focus. I assume because the value is not in the list. I also have continual headaches getting displayvalue or value to show up at init time. Where is the best place to set the value for displayvalue and value at runtime so it will be there when the form is open?
>
>Eric K.

Eric, this is the code from my combo of similar type.
In this partucular case I have the RowSource = 1 - Value and the combo.Value property has the expression "= myAlias.Description"
***combo.Init()
dodefault()
local lItemExists
lItemExists = .F. && assume the value isn’t in the list.
FOR i = 1 to THIS.ListCount
	IF THIS.List(i) = ALLTRIM(THIS.Value)
		lItemExists = .T.
		EXIT
	ENDIF
ENDFOR

IF !lItemExists
	local lcNewValue
	lcNewValue = THIS.Value
	THIS.AddItem(lcNewValue)
	THIS.DisplayValue = lcNewValue
	this.displayValue = this.Value
ENDIF
***

***combo.Valid()
local lItemExists
lItemExists = .F. && assume the value isn’t in the list.
FOR i = 1 to THIS.ListCount
	IF THIS.List(i) = ALLTRIM(THIS.Text)
		lItemExists = .T.
		EXIT
	ENDIF
ENDFOR

IF !lItemExists
	local lcNewValue
	lcNewValue = THIS.Text
	THIS.AddItem(lcNewValue)
	THIS.DisplayValue = lcNewValue
ENDIF
******
HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform