Hi D.Bane,
I'm glad you enjoy the new ToolTips!
I encourage your curiosity in the inner workings of Ecere, so I will satisfy it about those *Handler functions!
I hope one day this same curiosity will bring you to help us resolve the many pending issues on our
Mantis Bugtracker, to make Ecere as good as it ought to be!
So those *Handler methods, they are actually defined and declared in the ToolTip class themselves.
i.e. they are
not something defined by the base GUI toolkit, e.g. the Window class.
Their purpose is to override the respective OnMouseMove/OnMouseOver/OnMouseLeave/OnLeftButtonDown events of the window to which the tooltip is assigned (the window it describes, gives tips on,
tippedWindow in the code).
They are not called simply e.g. OnMouseOver, because this would override the ToolTip window's own event, rather than the 'tippedWindow''s. If you look at the code, you will see there is actually a OnMouseOver that handles the OnMouseOver event of the ToolTip itself (when your mouse moves over the actual tooltip).
The mere definitions of those methods do nothing by themselves, but they take effect when the tooltip is assigned to a window, and the code does:
Code: Select all
tippedWindow.OnMouseOver = OnMouseOverHandler;
tippedWindow.OnMouseLeave = OnMouseLeaveHandler;
tippedWindow.OnMouseMove = OnMouseMoveHandler;
tippedWindow.OnLeftButtonDown = OnLeftButtonDownHandler;
You will also notice some code that preserves the original mouse handles of the tippedWindow, saving it in e.g.
OrigOnMouseOver. You will also notice the original mouse handler is also chained at the end of the *Handler methods, and it is restored if the tooltip is 'detached' form the 'tippedWindow'.
All this code dynamics is rather complex, but it shows some of the flexibility of eC and the Ecere GUI toolkit
I will admit a lot of the trickiness of the code is due to the fact that I insisted on using the 'parent' property for the tippedWindow of the ToolTip class, so we could do (because '
parent' is the first property of any Window class):
ToolTip tt { button }; instead of ToolTip tt { tippedWindow = button };
even though button is never actually the parent ( The parent of a window, in the Ecere GUI toolkit, is the window within which the window is confined, obviously not the case for the tooltips ).
We should probably think of some eC feature to change this 'default' first property so we do not have to resort to such hacks... You will notice in the code for example the
watch(parent) which is invoked whenever the parent property is modified, which assigns tippedWindow to that value, and then goes and change the parent back to null (the desktop).
Just a fun thing to point out, the code you put in your first post would have endlessly created ToolTip classes, since the ToolTip derived from Window and Window contained a ToolTip instance!