>>>>
with getpem(thisform, m.abc)
>>>> .Visible = .t.
>>>>endwith
>>>>
>>>
>>>Yes! It's something that I always forget:)
>>>Cetin
>>
>>Same here. Probably best to avoid cause it's not really obvious what's happening.
>
>What do you mean, not obvious? GetPem returns a property - which could be an object since VFP3.
Hi Dragan
Please let me try to explain.
STORE "Dragan" TO m.lcName is obvious.
m.lcName = "Dragan" is slightly less obvious.
lcCmd = "STORE 'Dragan' to m.lcName"
*lots of code.
*lots of code.
*lots of code.
*lots of code.
&lcCmd.
Is far less obvious but may be necessary for the program.
GETPEM returning an object - is purely a performance trick. It isn't necessary.
In this case
LOCAL m.loLabel
A=SECONDS()
FOR X = 1 TO 100000
m.loLabel = GETPEM(THISFORM,"Label1")
ENDFOR
?SECONDS()-M.A
A=SECONDS()
FOR X = 1 TO 100000
m.loLabel = eval("THISFORM.Label1")
ENDFOR
?SECONDS()-M.A
Normally I want every iota of performance. GetPem took .289 seconds and eval took .380, but there's more to consider such as maintainability and readability. Code shouldn't be a puzzle.
It is not documented, it is not even indicated from the function name that it will return an object contained in another object. Maybe it should be called GetPOEM. :)
m.luSomething = getpem(THISFORM,"iuSomething")
Please tell me exactly what that code does. Would you agree that if you can't, it cannot be called "readable"? How many people can get it correct? You'd probably be able to figure it out from context, but that takes extra time.