Which "object" do you think should get the message
Posted: Sat Nov 04, 2006 2:59 pm
In a GUI, when some action, for example a mouse click, is done on object in a window, one of two things normally happen:
1. A mouse click message will be sent to the window, and the window will send it to the object.
2. The message will be directly sent to the object.
In the end, the object is the one that has the code to do something about the mouse click (for example, if it's a button, it will probably execute some code..) Plus, it takes off some CPU to have the window needlessly relay the same message. But on the other hand, by having the message come to the window first, your giving the window more control over all the object withinside of it.
Which do you think is better?
1. A mouse click message will be sent to the window, and the window will send it to the object.
2. The message will be directly sent to the object.
In the end, the object is the one that has the code to do something about the mouse click (for example, if it's a button, it will probably execute some code..) Plus, it takes off some CPU to have the window needlessly relay the same message. But on the other hand, by having the message come to the window first, your giving the window more control over all the object withinside of it.
Which do you think is better?