Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass value of parameters from UI to BIZ to DA
Message
 
 
To
21/01/2008 10:24:16
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01283283
Message ID:
01283646
Views:
9
What you are describe is exactly what I was experiencing. I probably misunderstood Cetin's message. Thank you for your very helpful input.

>The properties of the form are not visible to the biz class unless you make them visible. You can either:
>
>A) Pass the THISFORM pointer to the biz class:
*-- In the form Init:
>THIS.oBiz = NEWOBJECT ("MyBiz", "MyBiz")
>THIS.oBiz.oParent = THISFORM    && Assume that the biz class have a public property called oParent
>
>*-- In the biz class:
>THIS.My_Property = THIS.oParent.My_Property    && The form My_Property must be public
B) Pass the property to the biz class if it's read-only:
*-- In the form Init:
>THIS.oBiz = NEWOBJECT ("MyBiz", "MyBiz")
>THIS.oBiz.My_Property = THISFORM.My_Property    && The biz class My_Property must be public
C) Pass a parameter object to the biz class:
*-- In the form Init:
>THIS.oBiz = NEWOBJECT ("MyBiz", "MyBiz")
>loParam = NEWOBJECT ("MyParam", "MyParam")
>loParam.My_Property = THISFORM.My_Property    && The parameter class have a public property called My_Property
>THIS.oBiz.oParam = loParam    && Assume that the biz class have a public property called oParam
>
>*-- In the biz class:
>THIS.My_Property = THIS.oParam.My_Property
I prefer option C if you have many parameters to pass because everything is encapsulated inside one class. If you only have one parameter to pass and it's read-only, option B is good. Option A is the quick and dirty way to pass information, but it can also cause circular references and side effects if your not carefull.
>
>>I think what you are saying makes sense, very logical. But something does not work.
>>
>>Here is how I test this:
>>
>>I have the following line in a method of the BIZ class:
>>
>>
>>this.my_property = thisform.my_property
>>
>>
>>But I get error "Object is not contained in a Form." So it looks like even though I instantiate BIZ in the INIT method of the UI FORM and reference it to a property of the UI form, "thisform" cannot be references from BIZ class. What am I missing?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform