Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid after LostFocus - possible to simulate
Message
 
 
À
07/03/2002 13:35:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00629752
Message ID:
00629767
Vues:
9
Where the MUPDATEROWSOURCE method is called from?

>>>Is it possible to trigger a control's VALID event from the control's LOSTFOCUS event, and if so what is an example of the syntax?
>>>
>>>TIA
>>
>>Why do you want to do that? If you want to keep user in the field issue
* Lostfocus
>>This.SetFocus()
>>NODEFAULT
>
>I'm updating a combo Quick Books style, and from within the cbo class I ask the user if they really want to add a new item to the lookup tale.
>
>If they don't, I want focus to stay on the cbo class.
>
>The following code is from the MUPDATEROWSOURCE method...
>************************************************************
>
>lparameter tcItem
>if type("tcItem") = "U" .or. type("tcItem") = "L" .or. empty(tcitem)
>	return .f.
>endif	
>local lcAlias, lcField, lnSelect
>lcAlias = alltrim(This.cRowSourceAlias)
>lcField = alltrim(This.cRowSourceField)
>if empty(lcAlias) or empty(lcField)
>	return .f.
>endif
>if not used(lcAlias)
>	use (lcAlias) again in 0
>endif
>if not This.mValidateField()
>	return .f.
>endif
>lnSelect = select()
>_callingrec = RECNO()
>select (lcAlias)
>
>* this will check to see if there is an index tag to see if item exists, and use it
>* otherwise a LOCATE will be used.
>FOR nCount = 1 TO 254
>   IF !EMPTY(TAG(nCount))  && Checks for tags in the index
>      * ? CDX(nCount)     && Display .CDX names
>		IF UPPER(TAG(nCount)) = UPPER(lcField)		
>			tagexists = .t.
>			EXIT
>		ENDIF
>   ELSE
>   	  tagexists = .f.
>      EXIT  && Exit the loop when no more tags are found
>   ENDIF
>ENDFOR
>* IF UPPER(TAG(nCount)) = UPPER(lcField)
>IF tagexists
>	SET ORDER TO (lcField)
>	SEEK ALLTRIM(UPPER(tcItem))
>ELSE
>	locate for alltrim(upper(lcField)) == alltrim(upper(tcItem))
>ENDIF
>
>	
>if eof(lcAlias)
>
> 	if this.yesno("Add new record/value to "+alltrim(lcAlias)+"list?")
>		
> 		APPEND BLANK
> 		replace (lcField) WITH (tcItem)
>		* insert into (lcAlias) ( (lcField) ) values ( tcItem )
>*!*			IF CURSORGETPROP("Buffering")>1
>*!*			  =tableupdate(.t.)
>*!*			endif
>		* browse
>		if len(ALLTRIM(this.formadd)) > 4
>			* SELECT (lcalias)
>			IF this.formparam = .f.
>				do form (this.formadd)
>			ELSE
>				DO FORM (this.formadd) WITH ALLTRIM(UPPER(tcItem))
>			ENDIF
>		endif
>		this.Requery()
>	else
>		this.setfocus()
>	endif
>endif
>select (lnSelect)
>GOTO _callingrec
>return eof(lcAlias)
>
>**************************************************************
>If I do This.SetFocus I get an error 'Cannot call SetFocus from valid, rangehigh... etc.'
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform