Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Border Color
Message
From
03/10/2018 09:49:58
 
 
To
03/10/2018 02:56:15
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01662372
Message ID:
01662456
Views:
43
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
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform