Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Border Color
Message
De
03/10/2018 09:49:58
 
 
À
03/10/2018 02:56:15
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01662372
Message ID:
01662456
Vues:
44
Walter,

no idea if the function is called often, but first gut twitch would be to rewrite it (untested) along the lines you see below
(in the spirit of the thread on Chatter by Al on wasting computer cycles)
even if Getpem() is much faster than eval() or other ways to get object handles.
Have you tested such an approach?
	PROCEDURE setbordercolor
		LPARAMETERS nColor
		LOCAL oParent, lcPre, lcPost
		oParent = THIS.parent
	        lcPre = "m.oParent." + this.NAME + "_"
	        lcPost = ".BORDERCOLOR"
                
		 TRY
			Store m.nColor To;
			    (m.lcPre + "T" + m.lcPost), ;
			    (m.lcPre + "L" + m.lcPost), ;
			    (m.lcPre + "R" + m.lcPost), ;
			    (m.lcPre + "B" + m.lcPost), ;
			    (m.lcPre + "H" + m.lcPost)
		ENDTRY
		RETURN
	ENDPROC
as there are only 5 object path accesses, the intermediate locals might even be slower compared to (ugly):
	PROCEDURE setbordercolor
		LPARAMETERS nColor
		LOCAL lcPre
	        lcPre = "This.Parent." + this.NAME + "_"
		 TRY
			Store m.nColor To;
			    (m.lcPre + "T.BORDERCOLOR"), ;
			    (m.lcPre + "L.BORDERCOLOR"), ;
			    (m.lcPre + "R.BORDERCOLOR"), ;
			    (m.lcPre + "B.BORDERCOLOR"), ;
			    (m.lcPre + "H.BORDERCOLOR")
		ENDTRY
		RETURN
	ENDPROC
>
>	PROCEDURE setbordercolor
>		LPARAMETERS nColor
>		LOCAL oLine, oObject 
>
>		oObject = THIS
>		TRY
>			oLine = GETPEM(oObject.PARENT, oObject.NAME+"_T")
>			oLine.BORDERCOLOR = nColor
>			oLine = GETPEM(oObject.PARENT, oObject.NAME+"_L")
>			oLine.BORDERCOLOR = nColor
>			oLine = GETPEM(oObject.PARENT, oObject.NAME+"_R")
>			oLine.BORDERCOLOR = nColor
>			oLine = GETPEM(oObject.PARENT, oObject.NAME+"_B")
>			oLine.BORDERCOLOR = nColor
>			oLine = GETPEM(oObject.PARENT, oObject.NAME+"_H")
>			oLine.BORDERCOLOR = nColor 
>		ENDTRY
>		RETURN
>	ENDPROC
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform