Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
on, Class Browser
Message
From
26/05/1998 16:15:05
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
25/05/1998 12:54:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00101704
Message ID:
00102094
Views:
30
>this.custno = 100
>this.ocomponent = NEWOBJ('custmanager','bizobj')
>this.ocomponent.printinvoice(this)
>
>Ocomponent must know that this's property is named custno, where as if I just pass the customer number, ocomponent doesn't care anything about this.

The other way round, it has to know what does the number mean. In any scenario, a procedure/method/function must know what to do with the parameter. In case of just passing a number, you must train your method to recognize that number as a customer code; if passing a This, you must have your object name their properties in a consistent manner.

And there's an easy workaround (or maybe a future habit)- if you expect you'll have the custno named differently in various objects, you may pass the default propertyname as second parameter:

this.ocomponent.printinvoice(this, "custno")

this.ocomponent.printinvoice(thisform.txtCustno, "value")


And in the CustManager class' .PrintInvoice

Lparameters loCaller, lcProperty
do case
case type("loCaller")="N"
this.custno=loCaller
case type("loCaller.custno")="N"
this.custno=loCaller.custno
case type("lcProperty")="C"
this.custno=eval("loCaller."+lcProperty)
other
=messagebox("hey, whadd'ya want?")
return
endcase

This way you can use all thre ways of passing your custno to the same object.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform