Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding records to a table via combobox
Message
De
06/05/1998 12:29:48
 
 
À
06/05/1998 12:22:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00097388
Message ID:
00097398
Vues:
27
Thanks for the code Cetin -

I'll try it (and that was supposed to be metaphor...though there probably should be a metaphot;)

Sylvia

>>I feel like I'm beating a dead horse with yet another basic combobox problem (and it's probably the wrong metaphot), but here goes:
>>
>>I'd like to use a combobox to first display a list of cities and allow the user to select from that OR to add a new city directly to the table in the combobox if it isn't. I had seen several suggestions to add in the LostFocus event of the combo somthing like:
>>
>>If This.value <> This.DisplayValue
>>
>>Endif
>>
>>but this doesn't seem to be working for me.
>>
>>Can anyone help with specifics of this?
>>
>>Thanks!
>>
>>Sylvia
>Sylvia,
>Try with this class :
**************************************************
>*-- Class:        mycombo_edit (c:\temp\test.vcx)
>*-- ParentClass:  combobox
>*-- BaseClass:    combobox
>*
>DEFINE CLASS mycombo_edit AS combobox
>
>
>	Height = 22
>	Width = 100
>	DisabledBackColor = RGB(255,255,255)
>	aliasname = "None"
>	fieldname = "None"
>	Name = "mycombo_edit"
>
>
>	PROCEDURE When
>		THIS.REQUERY
>	ENDPROC
>
>
>	PROCEDURE LostFocus
>		Do While occurs("  ",this.displayvalue) > 0
>			this.displayvalue = strtran(this.displayvalue,"  "," ")
>		Enddo
>		This.displayvalue = Upper(Chrtran(Alltrim(This.displayvalue),"yi","IY"))
>		this.value = this.displayvalue
>	ENDPROC
>
>
>	PROCEDURE Init
>		WITH This
>			.rowsourcetype = 3
>			if lower(.fieldname)="none" or ;
>				lower(.aliasname)="none"
>				.fieldname = substr(.controlsource,rat(".",.controlsource)+1)
>				.aliasname = substr(.controlsource,1,;
>								rat(".",.controlsource)-1)
>			endif
>			.rowsource = [SELECT DISTINCT ]+THIS.fieldname +;
>				[ as dummy FROM ]+this.aliasname+[ where !empty(]+THIS.fieldname + ;
>				[) union ] +;
>				[SELECT this.displayvalue as dummy ] +;
>				[ FROM ]+this.aliasname + ;
>				[ INTO cursor qq order by 1 ]
>		ENDWITH
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: mycombo_edit
>**************************************************
Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform