Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combobox with free text
Message
De
21/08/2018 07:41:56
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01661681
Message ID:
01661684
Vues:
81
This message has been marked as the solution to the initial question of the thread.
>I wonder if there is a way to use a combobox that also allows free text entry? The list has different values from an array, but if I enter a text that is not found in the list it blanks out on Lostfocus.

Combobox allows free text entry, that's the idea behind the control.

Non-listed values are stored in the .DisplayValue property, not in .Value.
LOCAL Test AS FormWithACombobox

m.Test = CREATEOBJECT("FormWithACombobox")
m.Test.Show(1)

DEFINE CLASS FormWithAComboBox AS Form

	ADD OBJECT ACombo AS Combobox WITH Left = 10, Top = 10
	ADD OBJECT ATextField AS Textbox WITH Left = 10, Top= 40
	ADD OBJECT DisplayCurrentValue AS Label WITH Left = 10, Top = 70, Autosize = .T., Caption = "Combo values will be shown here"

	DIMENSION ComboValues(1)

	FUNCTION ACombo.Init

		ALINES(Thisform.ComboValues, "One, Two, Three, Four", 1, ",")
		This.RowSourceType = 5
		This.RowSource = "Thisform.ComboValues"

	ENDFUNC

	FUNCTION ACombo.Lostfocus
		Thisform.DisplayCurrentValue.Caption = TEXTMERGE("<<ALLTRIM(This.DisplayValue)>> (Value = '<<This.Value>>')")
	ENDFUNC

ENDDEFINE
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform