Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Example of ReadMethod and ReadExpression methods
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00247614
Message ID:
00247691
Views:
25
Hi Chuck.

>Can someone give me an example of where or how the ReadMethod and ReadExpression methods would work.

As Jim pointed out, these methods are generally used by builders, and are unavailable at runtime. ReadMethod reads the code in a method, typically so you can add to it and then write the new version back using WriteMethod. For example, I have a builder that adds some code to the RightClick method of every page in a pageframe:

lcCode = 'This.Parent.ShowMenu()' + chr(13)
for each loPage in Thisform.oObject.Pages
lcCurrentCode = loPage.ReadMethod('RightClick')
if not lcCode $ lcCurrentCode
loPage.WriteMethod('RightClick', lcCurrentCode + ;
iif(empty(lcCurrentCode), '', chr(13)) + lcCode)
endif not lcCode $ lcCurrentCode
next loPage

The key points here are the ReadMethod call, which reads the code from the RightClick method of a page, and WriteMethod, which puts the modified code back into the method.

ReadExpression is used to read the expression in a property. Although you can just use Object.Property to get the value of the property, if the property's value contains an expression like "=DATE()", Object.Property will return something like 07/29/1999 rather than "=DATE()". So, ReadExpression can be used to get the actual expression.

Doug
Previous
Reply
Map
View

Click here to load this message in the networking platform