Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What do you think of this picklist idea?
Message
De
13/07/1998 15:01:09
 
 
À
13/07/1998 14:08:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00116853
Message ID:
00116904
Vues:
18
>Bill,
>I couldn't get how "new" would prevent a requery nor what's wrong with a requery. And I get it's OK with "false newitems" so here is my class for those type of combos.
**************************************************
>*-- Class:        cmbself_edit (c:\vfpclasses\global.vcx)
>*-- ParentClass:  combobox
>*-- BaseClass:    combobox
>*
>DEFINE CLASS cmbself_edit AS combobox
>
>
>	Height = 22
>	Width = 100
>	DisabledBackColor = RGB(255,255,255)
>	aliasname = "None"
>	fieldname = "None"
>	Name = "cmbself_edit"
>
>
>	PROCEDURE When
>		THIS.REQUERY
>	ENDPROC
>
>
>	PROCEDURE LostFocus
>		This.displayvalue = Upper(Chrtran(Alltrim(This.displayvalue),"yi","IY")) && Local language fix
>		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: cmbself_edit
>**************************************************
With this class I generally set it to same controlsource as target field (w/o an extra lookup table - aliasname and fieldname are left as default). Test it if you have time (for now I'm about to leave).
>Cetin

Thanks Cetin
For some reason I was thinking that if I had the ComboBox using an alias as the RowSource that I wouldn't have to Requery() when the table changed (in a multiuser environment for example). I wasn't thinking very well.
Your solution is along the lines that I'm probably going to use. I'm probably going to union the select with a bogus table that just has '< New >' in a single record in the table. I'm trying to avoid having the user type anything into the combo box, just select the '< New >' selection and that will launch a maintenance form.

Now, I don't suppose you know of a way I can put a "union" in the view wizard, so I don't have to build it myself?
Bill Morris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform