Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding _Access methods
Message
From
22/04/2008 11:41:47
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01312365
Message ID:
01312396
Views:
9
Hi Sergey,

Thanks...I wondered if it should be "both" ways. Good to get a confirmation.

Albert

>It doesn't matter what actual value of the property is because it can only be accessed through _Access method. However for consistency I would keep it updated.
>
>
>* ioDocuments_Access()
>* 1 and 1/2 way:
>WITH THIS
>  IF NOT ISNULL(.ioServer)  && Word automation server open etc
>     STORE .ioServer.Documents TO .ioDocuments
>  ELSE
>     STORE .NULL. TO .ioDocuments
>  ENDIF
>ENDWITH
>RETURN This.ioDocuments
>
>
>>
>>Just coding my first _Access method as I found a use for it when using Word automation. Instead of trying to keep a property .ioDocuments up to date when creating a Word instance, I instead tried to use an .ioDocuments_Access() method.
>>
>>Question: am I supposed to set .ioDocuments within that code or am I supposed to return the reference from that method (or both); I read the "help" file but it did not make it clear.
>>
>>
>>
>>* ioDocuments_Access()
>>* first way:
>>
>>WITH THIS
>>
>>IF NOT ISNULL(.ioServer)  && Word automation server open etc
>>   STORE .ioServer.Documents TO .ioDocuments
>>ELSE
>>   STORE .NULL. TO .ioDocuments
>>ENDIF
>>
>>ENDWITH
>>
>>RETURN
>>
>>** second way, return the reference instead
>>
>>LOCAL loDocuments
>>
>>IF NOT ISNULL(.ioServer)
>>   STORE .ioServer.Documents TO loDocuments
>>ELSE
>>   STORE .NULL. to loDocuments
>>ENDIF
>>
>>ENDWITH
>>
>>RETURN (loDocuments)
>>
>>
>>
>>Albert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform