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.

you do to ensure that I don’t get lost when I’m coming to<br />

your new offices for the very first time?<br />

Paul: Easy, draw you a map!<br />

Andy: Give the man a cigar! So why don’t we apply this<br />

solution to this case? Figure 2 shows a map of the object<br />

hierarchy for the form shown previously.<br />

Paul: That’s pretty neat. It’s just a standard Organization<br />

Chart, isn’t it? It looks rather like the Object model<br />

diagrams that MS produces for what used to be OLE<br />

Automation (I can’t remember what it’s called this week).<br />

Andy: Yes, it was produced using the MS Organization<br />

Chart 2.0 add-on that ships with Office, and you can use<br />

it to work out how to reference things correctly. All you<br />

need to do is start “walking” from the initial object<br />

(“This”) toward the object you want to address. Each<br />

time you meet a shaded object, you must add that to<br />

the address—using “Parent” if you’re climbing up the<br />

tree, and the object’s name if you’re<br />

going down.<br />

Paul: Okay—let’s suppose I want the<br />

Save button to read the person’s<br />

“Known As” name. I start from the<br />

button with ‘This’, then move<br />

upwards and find myself at the<br />

cntFormMode object, which is shaded,<br />

so I add a parent reference to get<br />

‘This.Parent’.<br />

Carrying on upwards, I reach the<br />

form object (also shaded, so I need<br />

another “parent”) and get<br />

‘This.Parent.Parent’ before starting<br />

downwards again to arrive at<br />

cntName—which just gets added:<br />

‘This.Parent.Parent.cntName’. Finally,<br />

I reach the target text box, so my full<br />

address (for the Value property) is<br />

‘This.Parent.Parent.cntName<br />

.txtKnownAs.Value’.<br />

Figure 2. Object hierarchy diagram.<br />

Andy: Correct. Of course, you can<br />

also take a shortcut, since you can see<br />

from the object hierarchy that you<br />

have to get all the way up to the form<br />

before you can start downwards<br />

again toward your objective. So<br />

you can simply start directly<br />

from the form using “ThisForm”,<br />

which would give you the<br />

address ‘ThisForm.cntName<br />

.txtKnownAs.Value’. Figure 3. Improved object hierarchy diagram.<br />

Paul: There’s one thing your diagram doesn’t make<br />

clear—why can’t I go directly from cntFormMode to<br />

cntName without passing through the form? There’s a line<br />

between them, isn’t there?<br />

Andy: No, there isn’t. Remember, we’re dealing with a<br />

hierarchy, so you can only go up or down. In reality,<br />

there’s no direct connection between the two containers—<br />

it’s just drawn that way for simplicity. Each object in the<br />

top row is actually connected directly, and only, to the<br />

form. “All roads lead to Form” . Similarly, to get from<br />

one text box in a container to another in the same<br />

container, you must go up to the container level before<br />

starting back down again. I suppose a more correct<br />

representation of the situation would look like Figure 3<br />

(I’ve added a few other objects so that you can see<br />

how they fit).<br />

Paul: Yes, that’s quite clear now. I do things slightly<br />

differently. Because I don’t always work these things out<br />

in advance, what I often do is print out the form and then<br />

22 FoxTalk December 1998<br />

http://www.pinpub.com

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

Saved successfully!

Ooh no, something went wrong!