Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cool idea for SET commands
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00928029
Message ID:
00928035
Views:
35
>I wanted to find a way to easily set and restore SET commands. The goal was
>to set them at the top of a procedure, then restore them when the procedure ends.
>
>So I came up with this small class. It stores the current value of a SET command
>and when destroyed, restores the setting.
>
>Feedback wanted. Thanks


Yep. That's the standard way to use the benefits of OOP, letting the objct handle state and restore destroy, so you do not have that responsibility, and the problem of forgetting to restore.

Many OOP Frameworks in the market have this in one form or another (at least the one commercial one I use does).

Another way would be not to segregate all SETs into their one function/method, but do a tgeneric one for most SETs where you pass the setting you want as a parameter (TALK/CONFIRM/SAFETY/etc)

For individual ones you can also add a set of objects to keep the current ALIAS() before a SELECT xxx, to keep FULLPATH(CURDIR()) before a SET DEFAULT TO (or CD), to save/restore PATH, to save/restore controlling index tag, and anything else you can think of.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Reply
Map
View

Click here to load this message in the networking platform