Q about code in haiku interface kit

What does this code ?
BBox::MouseDown(BPoint point)
{
BView::MouseDown(point);
}
When you inherrit from a object(in this case bview)you get this automatic right?

Regards,

Remco johannes

It does its own MouseDown action (currently nothing) and then calls the parent class function to do the other normal MouseDown processing.


If you do not specify a BBox::MouseDown function, then the parent BView one is automatically called. If you do specify BBox::MouseDown then it gets control and the BView::MouseDown is not used. If you want to have the normal handling of a mousedown plus your own actions, then you call the parent BView::MouseDown to do the normal actions and add your actions before or after the call (depending on what they do).

[quote=agmsmith]It does its own MouseDown action (currently nothing) and then calls the parent class function to do the other normal MouseDown processing.


If you do not specify a BBox::MouseDown function, then the parent BView one is automatically called.
[/quote]

Yes that’s why i asked, basicly this call is -in this case- unnecessary.
Why you make call that does nothing besides adding overhead?

I hope my question is clear

Remco Johannes

The reason that these methods are defined in the Interface Kit even though they just call the parent action is simply so that we could easily modify them to take some other action if we wanted to without having to first include the boiler plate. This has made documenting the API more difficult and was probably a bad idea.

Yes that’s why i asked, basicly this call is -in this case- unnecessary. Why you make call that does nothing besides adding overhead?

You're right, it's unnecessary. Makes the code larger and slower without doing anything.

ok, tnx for the info

This is actually there for BeOS binary compatibility. If you look in the BeOS, that method probably did something more. Our implementation is different, and as a result we have nothing to do there anymore. However, BeOS apps do call the method, so we have to make sure it’s there, otherwise you would get a “symbol not found” error when trying to run such apps.