Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP objects talking to each other
Message
From
05/12/2002 10:35:51
 
 
To
05/12/2002 08:00:14
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00729821
Message ID:
00729890
Views:
25
Sure, here is an example I put together for you, somehow it even works!
Local lof As Form

lof = Createobject('MediatorForm')
lof.Show(1)


Define Class MediatorForm As Form
	Visible = .T.
	AutoCenter = .T.
	Height = 80
	Width = 160
	Caption = 'Mediating Container'

	Add Object tickletext1 As tickletext ;
		WITH ;
		top = 10,;
		left = 10, ;
		visible = .T.


	Add Object tickletext2 As tickletext ;
		WITH ;
		top = 10, ;
		left = 80, ;
		visible = .T.

	Function showentry
	Lparameters tcName
	If tcName = This.tickletext1.Name
		This.tickletext2.Value = This.tickletext1.Value
	Else
		This.tickletext1.Value = This.tickletext2.Value
	Endif
	Endfunc

Enddefine


Define Class tickletext As TextBox
	Width = 70

	Function LostFocus
	This.Parent.showentry(This.Name)
	Endfunc
Enddefine
Glenn
>Hi
>
>Have you got any examples/notes on this method? I've never tried it before.
>
>Thanks
>Kev
>
>>I believe that it is "Best Practice" to invoke a mediator for this purpose. The parent object should communicate with both objects. In this case the object which triggers the event should notify the Parent object and then the parent object should take any necessary actions with it's children objects.
>>
>>Glenn
>>
>>>Hi
>>>
>>>What's the best way to do the following? I have an object that needs to call methods in another object.
>>>
>>>Is it best to create the object you want to talk to, in a property on the object?
>>>
>>>Or are there other/better ways?
>>>
>>>Thanks
>>>Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform