04.08.2013 Views

Un-Mapping Mapped Network Drives Andrew Coates - dFPUG-Portal

Un-Mapping Mapped Network Drives Andrew Coates - dFPUG-Portal

Un-Mapping Mapped Network Drives Andrew Coates - dFPUG-Portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

value in an array property of itself. It also has a Restore<br />

method that restores the value of one or all saved<br />

properties. The Restore method is also called from the<br />

Destroy method, so when the _ObjectState object goes out<br />

of scope, everything is restored automatically. Since the<br />

array property has a single row for each saved property,<br />

you can’t use this class to provide multiple levels of undo;<br />

however, you could subclass _ObjectState and add this<br />

behavior if desired.<br />

Where might we use such a class? One situation<br />

involves things a user can change but might want to<br />

change back. For example, you might allow a user to<br />

rearrange and resize the columns in a grid, but provide a<br />

“Reset to Default” function that puts them back. Another<br />

place would be when you temporarily change the<br />

properties of an object (perhaps so it behaves differently),<br />

do something with the object, and then change them back<br />

again. Rather than having a set of local variables that save<br />

the property values and then having to manually restore<br />

them before the routine ends, you could do something<br />

like this:<br />

local loObjectState<br />

loObjectState = newobject('_ObjectState', '_app.vcx', ;<br />

'', This)<br />

loObjectState.Set('

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!