Forgive my obvious brain-cramp, but I just can't seem to figure out how
to use tooltips. I'd like to add some tooltips to a variety of push buttons on a Presenter that does not have a toolbar. I've found that tooltips work "automagically" on toolbars by simply specifying the commandDescription text. But, when I specify the commandDescription text for an ordinary push-button, no "fly-by" happens. What am I missing here? The Tooltip class seems to be what I need but I'm feeling like I'm on Oceanic flight 815 - Lost.... Thanks for the help Keith |
I've been contemplating addig a tool tip to the status line of the
SUnitBrowser (for when the message it shows is bigger than you can see and contains CR's). Anyway, not sure if this helps but the following article might still be relevent for D6 but I haven't tried it yet. http://www.stevewaring.net/blog/articles/ToolTipResuse.html Tim "keith" <[hidden email]> wrote in message news:[hidden email]... > Forgive my obvious brain-cramp, but I just can't seem to figure out how > to use tooltips. I'd like to add some tooltips to a variety of push > buttons on a Presenter that does not have a toolbar. I've found that > tooltips work "automagically" on toolbars by simply specifying the > commandDescription text. But, when I specify the commandDescription > text for an ordinary push-button, no "fly-by" happens. > What am I missing here? The Tooltip class seems to be what I need but > I'm feeling like I'm on Oceanic flight 815 - Lost.... > > Thanks for the help > > Keith > |
Keith, Tim,
> I've been contemplating addig a tool tip to the status line of the > SUnitBrowser (for when the message it shows is bigger than you can > see and contains CR's). Anyway, not sure if this helps but the > following article might still be relevent for D6 but I haven't tried > it yet. > > http://www.stevewaring.net/blog/articles/ToolTipResuse.html > > Tim > > "keith" <[hidden email]> wrote in message > news:[hidden email]... > > Forgive my obvious brain-cramp, but I just can't seem to figure out > > how to use tooltips. I'd like to add some tooltips to a variety of > > push buttons on a Presenter that does not have a toolbar. I've > > found that tooltips work "automagically" on toolbars by simply > > specifying the commandDescription text. But, when I specify the > > commandDescription text for an ordinary push-button, no "fly-by" > > happens. What am I missing here? The Tooltip class seems to be > > what I need but I'm feeling like I'm on Oceanic flight 815 - > > Lost.... You can probably still use Steve Waring's tool tip re-use advice (as Tim suggests) but you may find it easier to use a MessageBubble. Take a look at the class comment and try the example. For your purposes you may want to send the bubble #isBalloon: false. Best regards, -- Andy Bower Dolphin Support www.object-arts.com |
Cool - I can get the tooltips bubble up and running in a workspace- but in a
user interface what event do I capture to then trigger my MessageBubble code? I'm a bit sketchy on this area, so a little hint to get me going would be really appreciated. I was hoping that something: self statusTextPresenter when: #mouseHovering: send: #statusHoverHelp: to: self would work - but I get nothing. If I look at onMouseHovering inherited by a TextPresenter it seems to forward this message to a view, but: self statusTextPresenter view when... still does nothing. So I'm a bit off in my thinking I guess... Any tips? Tim "Andy Bower" <[hidden email]> wrote in message news:[hidden email]... > Keith, Tim, > >> I've been contemplating addig a tool tip to the status line of the >> SUnitBrowser (for when the message it shows is bigger than you can >> see and contains CR's). Anyway, not sure if this helps but the >> following article might still be relevent for D6 but I haven't tried >> it yet. >> >> http://www.stevewaring.net/blog/articles/ToolTipResuse.html >> >> Tim >> >> "keith" <[hidden email]> wrote in message >> news:[hidden email]... >> > Forgive my obvious brain-cramp, but I just can't seem to figure out >> > how to use tooltips. I'd like to add some tooltips to a variety of >> > push buttons on a Presenter that does not have a toolbar. I've >> > found that tooltips work "automagically" on toolbars by simply >> > specifying the commandDescription text. But, when I specify the >> > commandDescription text for an ordinary push-button, no "fly-by" >> > happens. What am I missing here? The Tooltip class seems to be >> > what I need but I'm feeling like I'm on Oceanic flight 815 - >> > Lost.... > > You can probably still use Steve Waring's tool tip re-use advice (as > Tim suggests) but you may find it easier to use a MessageBubble. Take a > look at the class comment and try the example. For your purposes you > may want to send the bubble #isBalloon: false. > > Best regards, > > -- > Andy Bower > Dolphin Support > www.object-arts.com |
TimM wrote:
> So I'm a bit off in my thinking I guess... > > Any tips? Hi Tim, I can only help you with Tooltips using Callbacks here .... First of all you need to "fix" a method in class Tooltip to enable text callbacks. As this medhod is not called from any method in the base image and does everything for text callbacks (except confusing TTF_CENTERTIP and TTF_SUBCLASS) I assume this is simply the wrong constant: Tooltip>>registerView: aView self ttmAddTool: ((TOOLINFOA new) uFlags: ##(TTF_IDISHWND | TTF_SUBCLASS); textCallback; hwnd: aView asParameter; uId: aView asParameter; yourself) If you then register a newly created tooltip with a view you'll get text callbacks. E.g.: presenter := Shell show. view := presenter view. view toolTipWindow: ((Tooltip new) isBalloon: true; create; registerView: view; yourself). block := [:aNMTTDISPINFO | aNMTTDISPINFO text: 'Hello World']. presenter when: #tipDetailsRequired: send: #value: to: block You'll have three posibilities to use text callbacks: 1) Overriding #onTipDetailsRequired: in your Presenter 2) Overriding #onTipDetailsRequired: in your View 3) Catching the #tipDetailsRequired: event triggered by the presenter (as used in the example). Hope this helps. CU, Udo |
Hi Udo, thanks for the tip.
> First of all you need to "fix" a method in class Tooltip to enable > text callbacks. As this medhod is not called from any method in the > base image and does everything for text callbacks (except confusing > TTF_CENTERTIP and TTF_SUBCLASS) I assume this is simply the wrong > constant Is this a safe change to make in the image (e.g. if its part of Intelli-Dolphin will it hose people?) If it is safe, should it be reported to OA? I tried your example, and I had to get quite messy to make it work for the SUnitBrowser (there's a real train wreck to get the correct view) - eg. statusView := self statusTextPresenter view parentView. statusView toolTipWindow: ((Tooltip new) isBalloon: false; alwaysTip: true; showDuration: 1000*120; reshowDelay: 500; create; registerView: statusView ; yourself). I also have a problem with the tooltip not showing again if I leave it to time out (which seems to be about 5 seconds even if I try to make it longer - like I have tried above). Any ideas why this might be the case? Tim |
macta wrote:
> Is this a safe change to make in the image (e.g. if its part of > Intelli-Dolphin will it hose people?) If it is safe, should it be > reported to OA? Of course it's safe :-) AFAIK there is no sender of this method in the base image - so yes, I assume it's safe. This issue was also reported during the Beta for DSTX6. I think there were more important things to do .... so it may be changed in later patchlevels. > I tried your example, and I had to get quite messy to make it work for > the SUnitBrowser (there's a real train wreck to get the correct view) - eg. Please note that one tooltip view can be used for mutliple views ... there is not need to create a new tooltip view for each view requiring a tooltip. Simply register multiple views using Tooltip>>registerView. One of the things I do i.e. is defining an additional method for CommandButtons to let them take care of their own tooltips (using the commandDescrtiptions description). CommandButton>>onTipDetailsRequired: aNMTTDISPINFOA aNMTTDISPINFOA text: self commandDescription toolTipText Having this method allows you to write something like this: shell := Shell show. button := shell view addSubView: PushButton new. button text: 'Test'. button commandDescription command: #close. shell view toolTipWindow: ((Tooltip new) isBalloon: true; create; yourself). (shell view toolTipWindow) registerView: shell view; registerView: button. block := [:aNMTTDISPINFO | aNMTTDISPINFO text: 'Hello World']. shell when: #tipDetailsRequired: send: #value: to: block Note that I use only ONE tooltip control but register two views (shell and button). Both views are also using two different ways to handle the text callback. The shell uses the #tipDetailsRequired: whereas the Button handles this "internally" using the method above. Normally I create a tooltip control for every Shell I'm having. As you might have seen there is no need to define an additional instance variable to hold the Tooltip View. Each view has a property called #tooltipWindow which can be accessed using #tooltipWindow/#tooltipWindow:. I usually create the tooltip and register views in #onViewOpened. For controls where you do not want to use callbacks you can still use Tooltip:>>add:tool: . > I also have a problem with the tooltip not showing again if I leave it > to time out (which seems to be about 5 seconds even if I try to make it > longer - like I have tried above). Any ideas why this might be the case? Can't help you here ... I assume this is how tooltips are implemented. AFAIK a tooltip will not be redisplayed for a tool once it was displayed for this tool ... except you hover another tool in between. You might wnat to take a look at the Tooltip documentation on MSDN. Although class Tooltip wraps up most of the functionality covered there it might give you some deeper insight: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/tooltip.asp Hope this helps. Regards, Udo |
Udo Schneider wrote:
> Normally I create a tooltip control for every Shell I'm having. As you > might have seen there is no need to define an additional instance > variable to hold the Tooltip View. Each view has a property called > #tooltipWindow which can be accessed using > #tooltipWindow/#tooltipWindow:. I usually create the tooltip and > register views in #onViewOpened. For controls where you do not want to > use callbacks you can still use Tooltip:>>add:tool: . Small addition to use an Balloon icon and title: shell := Shell show. button := shell view addSubView: PushButton new. button text: 'Test'. button commandDescription command: #close. shell view toolTipWindow: ((Tooltip new) isBalloon: true; hasCloseButton: false; create; ttmSetTitle: 'Tooltip title' icon: Tooltip icon asParameter; yourself). (shell view toolTipWindow) registerView: shell view; registerView: button. block := [:aNMTTDISPINFO | aNMTTDISPINFO text: 'Hello World']. shell when: #tipDetailsRequired: send: #value: to: block Please note that Tooltip>>ttmSetTitle:icon: expects an Integer as icon. This can be a value between 0-3. Every other value is considered to be an HICON (can be obtained by sending #asParameter to instances of class Icon). Please refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/messages/ttm_addtool.asp for more information. You can even set the title and icon in a callback .... but please note that this affects the tooltip for ALL registered controls. So either set the title icon in each callback for each control or use multiple tooltip controls for views setting the icon/title and views that don't. To set the icon/title you need to Tooltip>>ttmSetTitle:icon: from within the callback. Either you have a refernce to the tooltip accessible (i.e. using #tooltipWindow) or query NMTTDISPINFO for the control: block := [:aNMTTDISPINFO | (View fromHandle: aNMTTDISPINFO hwndFrom) ttmSetTitle: 'Title set in Callback' icon: True icon asParameter. aNMTTDISPINFO text: 'Hello World']. CU, Udo |
In reply to this post by Udo Schneider
WOW Thanks for all of the detailed notes... Doesn't quite work how I expect
and MSDN indicates but by putting my timeout parameter after create, at least it shows the tooltip again. I'm sure all of your text will help many others too... thanks for sharing. Tim > Please note that one tooltip view can be used for mutliple views ... > there is not need to create a new tooltip view for each view requiring > a tooltip. Simply register multiple views using Tooltip>>registerView. |
macta wrote:
> WOW Thanks for all of the detailed notes... Doesn't quite work how I > expect and MSDN indicates but by putting my timeout parameter after > create, at least it shows the tooltip again. This seems to be a general .... "issue". E.g. Tooltip>>ttmSetTitle:icon: does only work after the control as been created. It seems some settings must be set *before* the creation, some may and others must not ..... I'm sure it's all documented in some obscure docs ..... :-) > I'm sure all of your text will help many others too... thanks for sharing. Thanks for the flowers .... although I have to admit that it's much easier in DSTX6 than it was in DST5. I implemented must of the stuff myself in DST5 ..... only to discover that Andy and Blair did a much better job in DSTX6 :-) CU, Udo |
Free forum by Nabble | Edit this page |