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
From
21/01/2008 10:48:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01283283
Message ID:
01283658
Views:
9
>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?
Public oForm
oForm = Createobject('myUIClass','Customer')
oForm.Show()

Define Class myUIClass As Form
	table_name = ''
	Add Object btnCheck As CommandButton With Caption='Check'
	Procedure Init(tcTableName)
		This.table_name = m.tcTableName
		This.AddObject('myBiz','myBiz')
		This.AddObject('myDa','myDa')
	Endproc

	Procedure btnCheck.Click
		TEXT TO m.lcInfo TEXTMERGE noshow
Form.Table_Name:<<thisform.table_Name>>
Biz Table_Name:<<thisform.myBiz.table_Name>>
Biz Name:<<thisform.myBiz.BizName>>
Da table_name:<<thisform.myDa.Table_Name>>
Da bizName:<<thisform.myDa.BizName>>
		ENDTEXT
		Messagebox(m.lcInfo)

		Thisform.myDa.FillPropertiesFromBiz(Thisform.myBiz)

		TEXT TO m.lcInfo TEXTMERGE noshow
Form.Table_Name:<<thisform.table_Name>>
Biz Table_Name:<<thisform.myBiz.table_Name>>
Biz Name:<<thisform.myBiz.BizName>>
Da table_name:<<thisform.myDa.Table_Name>>
Da bizName:<<thisform.myDa.BizName>>
		ENDTEXT
		Messagebox(m.lcInfo)

	Endproc
Enddefine

Define Class myBiz As Custom
	table_name = ''
	BIZName = ''
	Procedure Init
		This.BIZName = Sys(2015)
		This.table_name = Thisform.table_name
	Endproc
	Procedure ReadUIProperties
		This.table_name = Thisform.table_name
	Endproc
Enddefine

Define Class myDa As Custom
	table_name = ''
	BIZName = ''
	Procedure Init
		This.table_name = Thisform.table_name
	Endproc
	Procedure FillPropertiesFromBiz(oBiz)
		This.table_name = oBiz.table_name
		This.BIZName = oBiz.BIZName
	Endproc
Enddefine
Or if the BIZ and DA were drag&dropped it'd look like:
Define Class myUIClass As Form
	table_name = ''
	Add Object myBiz As myBiz
	Add Object myDa As myDa
	Add Object btnCheck As CommandButton With Caption='Check'
	Procedure Init(tcTableName)
		This.table_name = m.tcTableName
		This.myBiz.ReadUIProperties()
		This.myDa.FillPropertiesFromBiz(This.myBiz)
	Endproc

	Procedure btnCheck.Click
		TEXT TO m.lcInfo TEXTMERGE noshow
Form.Table_Name:<<thisform.table_Name>>
Biz Table_Name:<<thisform.myBiz.table_Name>>
Biz Name:<<thisform.myBiz.BizName>>
Da table_name:<<thisform.myDa.Table_Name>>
Da bizName:<<thisform.myDa.BizName>>
		ENDTEXT
		Messagebox(m.lcInfo)
	Endproc
Enddefine
IOW even the first object that's initting has access to outermost object properties (form).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform