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 14:08:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/07/1998 14:02:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00116853
Message ID:
00116875
Vues:
22
>>>I'm interested in building a ComboBox picklist that has a '< New >' selection in it (like Quicken's Pulldown picklists).
>>>I don't like the idea of using a view as the RowSource, because of the constant Requery()s, so I'm thinking of using the base table and (1) appending a blank record (with '< New >' as the name), (2) deleting it (and re-appending it if a pack is done), (3) always using buffering for the forms that use it, and (4) Recalling it in GotFocus() and Deleting it again in LostFocus().
>>>
>>>What kind of problems do you think I'll run into?
>>>
>>>TIA
>>Bill,
>>With "new" as an option it's open to false newitems, right (ie: Mushroom where already MUSHROOM exist or A.Appendicitis where Acute Appendicitis already is there) ? If this is acceptable what about setting rowsource to SQL (distinct) and union current displayvalue in a common upper, lower or proper format?
>>Cetin
>
>Hi Cetin,
>I got a little lost in your explanation, so if I misunderstood, please correct me.
>About 'false newitems': I don't think there is any way to prevent those kind of problems (users will always overlook what is in the list).
>I'm trying to avoid having to do constant Requery()s to keep the list current, and I assume that setting the RowSource to SQL would require that.
>
>Did I misunderstand something?
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform