Ecere SDK/eC Forums https://ecere.org/community/ Print view |
|
Q1 - Tooltips https://ecere.org/community/viewtopic.php?f=5&t=212 |
Page 1 of 1 |
Author: | D.Bane [ Mon Jan 16, 2012 1:16 pm ] |
Post subject: | Q1 - Tooltips |
Hi to all. I wanted to add the Tooltip control/class to the Window class and had no success as there were few other things that I did not understand as well, which I want to include in the Tooltip class. The reason I was thinking about the tooltips is that I believe that they are very important in any application as sometimes there is a need to explain a bit more then the name of the button truly explains the action to the end user. I thought of making it do a for loop and check if the mouse is over any control and if that control has useTooltip=true then show it, but I believe that it would be better to have a Tooltip class inside Window class and that every control checks it out for itself instead. I did take a look at the ecere.dll (source) and was thinking about adding it directly to the "class Window{" by making something as: Code: Select all
Thank you upfront, D.Bane. |
Author: | jerome [ Sat Feb 04, 2012 12:51 pm ] |
Post subject: | Re: Q1 - Tooltips |
Hi again D.Bane! Ecere now has tooltips ! I've decided to add a String property called toolTip to the CommonControl class. You can also instantiate the ToolTip class itself, giving you the opportunity to change the looks. Please pull the latest code from github. The following sample code demonstrates both options. I've also attached it to this post. Code: Select all
From now on both of these samples, along with the earlier TextScroller, will be found in the samples directory under sdk/samples/guiAndGfx directory as well. All the best! Jerome |
Author: | D.Bane [ Wed Feb 08, 2012 8:36 am ] |
Post subject: | Re: Q1 - Tooltips |
Nice You did this really fast Oh, also, I forgot to write this in the first post, I hope that you had great time for the New Years. I really like that you added the option to modify it as needed. But, I will need to pick your brain a bit Sorry, like to know things, especially if they are cool I immediately opened the Ecere.dll (source) and found Tooltip, but I was wondering about few things like Code: Select all
Code: Select all
Thank you, D.Bane. |
Author: | jerome [ Sat Feb 11, 2012 3:10 am ] |
Post subject: | Re: Q1 - Tooltips |
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
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! |
Author: | D.Bane [ Sun Feb 12, 2012 4:22 pm ] |
Post subject: | Re: Q1 - Tooltips |
Hi Jerome. Yes, I thought that it should be done in a different way, but in the same time I did not know exactly how to approach it, but you made it great. I especially like the ability to change the style of it, as well as to have it transparent. Oh, sorry, I passed trough the code and got distracted by the *Handler functions and had missed the part where they are assigned to regular events. I really thought that they were in Ecere Window class where I went immediately but had not found them .. now I know why Thank you Jerome, all the best. D.Bane. |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |