Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 6.0 SaveAsClass - Header, Column,Page
Message
From
05/10/1998 08:43:08
 
 
To
05/10/1998 07:00:05
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00143459
Message ID:
00143827
Views:
38
>>>>COOOLL it works!!!
>>>>here is the function I came up with:
>>>>
>>>>
>>>>FUNCTION CopyProp
>>>>LPARA o1, o2
>>>>
>>>>IF TYPE('o1.Name') <> "C" OR TYPE('o2.Name') <> "C"
>>>>	RETURN .F.
>>>>ENDIF
>>>>
>>>>AMEMBERS(aProps, o1)
>>>>
>>>>FOR i = 1 TO ALEN(aProps)
>>>>	IF !ALLTRIM(UPPER(aProps(i)))$"CLASS:PARENTCLASS:BASECLASS:NAME"
>>>>		uVal = GETPEM(o1,aProps(i))
>>>>		IF PEMSTATUS(o2,aProps(i),5) AND;
>>>>			!PEMSTATUS(o2,aProps(i),1) AND;
>>>>			PEMSTATUS(o2,aProps(i),3) = TYPE('uVal') AND;
>>>>			!PEMSTATUS(o2,aProps(i),2)
>>>>			o2.&aProps(i) = uVal
>>>>		ENDIF
>>>>	ENDIF
>>>>ENDFOR
>>>>
>>>>
>>
>>Good. Got a copy of code. Beware there is at least one situation that this will fail -> getpem(object, "value") and unfortunately controlsource is a general field.
>>>Cetin
>>
>>Ahem. I mistakenly posted code from an old window. There's one too many lines in there; the line:
>>PEMSTATUS(o2,aProps(i),3) = TYPE('uVal') AND;
>>
>>doesn't belong, it fails for obvious reasons. I misread the use of the '3' parameter.
>>
>>Cetin, I have tested the code, and it works fine with ControlSource and value. Maybe I'm not understanding your warning... what properties would I have to use ReadExpression and WriteExpression with? (I guess using WriteExpression would get rid of the macro expansion...)
>
>Erik,
>Suppose your controls are instantiated and you read "value" property, where control's controlsource is a genfield. There getpem() is N/A and generates error.
>Readexpression is slightly different from just reading property. ie: a property might have a setting as =iif(recno()%2=0,"Even","Odd"). If you just read property you would get "Even" or "Odd". OTOH readexpression would get iif(recno()%2=0,"Even","Odd") and writeexpression would write it as is. Especially for grid.dynamic* this is important where expression is evaluated not only in init. To add it to your code you could readexpression() and if it's empty, then getpem, otherwise writeexpression.
>Cetin

Ahhh, ok. Thanks for the pointer.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform