Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending messages between objects
Message
From
01/06/2001 10:11:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/06/2001 09:53:11
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00513746
Message ID:
00513758
Views:
14
Jens,
Many ways to handle. With VFP6 a simple way might be to use assign :

thisform.setall('MessageArrived',uMessage)

*Custom method HandleMessage - appears in classes with this functioanlity
lparameters tuMessage, tcCallerMethod
tcCallerMethod is something like :
frmMyForm.myObject.Setall
do whatever with tuMessage

*MessageArrived - cutom property
*MessageArrived_Assign
lparameters vValue
this.HandleMessage(vValue,program(1))

Cetin

>It would be interesting to hear some opinions on object references are handled and the pro and cons of different approaches.
>
>Let's say I have a form with a contained business object (cusEmployee). The form also has a PageFrame with several pages. The reason cusEmployee is on the form is that it will be used by object on other pages as well.
>
>In one of the pages there is another business object (cusSchedule) that needs to talk to cusEmployee. How do you handle this; do you send an object reference via a form method to cusSchedule, or does cusSchedule talk to cusEmployee directly. I don't really like the idea of the latter because it's not a good practice to have sibling object having to know about each other, or am I wrong here? Are there other ways of doing this? Could the cusSchedule object send a message to the form, like this: ThisForm.GetEmployeeObjectReference(), that in turn would return an object reference to the cusEmployee? Or should the cusEmployee object be responsible of finding or creating a object reference to cusEmployee by itself?
>
>If cusSchedule gets passed a reference to cusEmployee by the form, do you keep the reference in a property, or do you release the reference as soon as you're finished using it?
>
>I would really appreciate some opinions here, cause I have a (bad) feeling I'm not using the best approach myself and I would like to find I good practice I could stick to.
>Thanks!
Ç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