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
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
tmrRefresh object:<br />
ThisForm.Refresh<br />
This.Enabled = .F.<br />
To help make the point clearer, the following is the<br />
code for the cmdNext CommandButton:<br />
ThisForm.ors.MoveNext<br />
Did you notice that a call to the Refresh method of the<br />
form isn’t present in the CommandButton? The same is<br />
true for the other navigation buttons as well. What does<br />
this mean? It means that code only has to exist in one<br />
location. The alternative is to have method calls in<br />
multiple locations. Since the COM events aren’t surfaced<br />
in VFP, this is usually a required course of action. With the<br />
ability to both recognize events and attach VFP code to<br />
those events, refresh code only has to be written once<br />
and, most importantly, only called from one location: the<br />
MoveComplete event. What’s the benefit? Whether you<br />
navigate via a CommandButton or the DataGrid control,<br />
the MoveComplete event will fire. The form will refresh.<br />
Clearly, this is a much better design—especially from a<br />
code maintenance standpoint.<br />
At this point, you might be asking, why the Timer<br />
Control? I had problems calling the Refresh method<br />
directly in the event. To avoid errors and get the correct<br />
functionality, the Refresh method had to be called after<br />
the MoveComplete event fired. At this point, I don’t<br />
know what’s causing the problem. I’ll be reporting this<br />
to the VFP team at Microsoft and will report back on<br />
their response.<br />
A quick word on the _VFP AutoYield property<br />
By default, the AutoYield property of the _VFP object is<br />
set to .T. This means that VFP will automatically process<br />
pending Windows events that occur between the<br />
execution of VFP program code. For this solution to work<br />
properly, you must be sure that the AutoYield Property is<br />
set to .F. Otherwise, the events will never be surfaced in<br />
VFP. This task is taken care of in the Load event of the<br />
form. The AutoYield setting is reset to the default in the<br />
Destroy event.<br />
Conclusion<br />
Once again, the joining of VFP, Visual Basic, and ADO<br />
can prove to be a powerful combination. Using a Visual<br />
Basic-created ActiveX control provides a way to bring<br />
functionality that doesn’t exist in VFP. For this reason,<br />
it’s more important than ever to go beyond VFP and give<br />
serious consideration to the other tools Visual Studio<br />
has to offer.<br />
Language aside, this article brings to light issues<br />
to ponder when considering a design. Clearly, when<br />
possible, make use of events to centralize code—as<br />
opposed to making redundant method calls. From a<br />
maintenance standpoint, you’ll definitely save yourself<br />
Figure 4. The live VFP form implementing the two<br />
ActiveX controls.<br />
a lot of work.<br />
Finally, I want to take this opportunity to thank my<br />
writing partner and friend Rod Paddock for being a great<br />
sounding board for this article. This is definitely new and<br />
uncharted territory. Rod’s assistance was invaluable when<br />
I needed to negotiate the rough spots. ▲<br />
12PETERS.ZIP at www.pinpub.com/foxtalk<br />
John V. Petersen, MBA, is vice president of IDT Marketing Systems and<br />
Services, a Philadelphia-based marketing database consulting firm. John<br />
has presented at numerous developer conferences, including DevCon 97,<br />
Tech-Ed, and the Southwest Visual FoxPro Conference. John is a Microsoft<br />
Most Valuable Professional (MVP) and a co-author of Developing Visual<br />
FoxPro 5.0 Enterprise Applications and Hands-On Visual Basic 5—Web<br />
Development, both from Prima Publishing. j_petersen@idtmarketing.com.<br />
18 FoxTalk December 1998<br />
http://www.pinpub.com