How to set tip for a StatusBarItem?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set tip for a StatusBarItem?

Dmitry Zamotkin-3
Hello, all!

I have tried to use StatusBar>>setItem:tipText: but without any results.
It's calling from StatusBarItemAbstract>>updateTipText and that has comment:

 "Private - Update the receiver's tool tip text.
 We set this to be the same as the receiver's text so that full text can be
viewed when
 truncated."

I also have increased a string to display in StatusBarItem but tooltip text
not wanted to show.

Thanks in advance,
Dmitry Zamotkin


Reply | Threaded
Open this post in threaded view
|

Re: How to set tip for a StatusBarItem?

Ian Bartholomew-4
Dmitry,

> I have tried to use StatusBar>>setItem:tipText: but without any results.

I had a look at this and came up with the following ...

There is one error (at least) as StatusBarItem>>getTipText should answer a
String rather than self as it does at the moment - a missing ^.

The bad news is that even if you do fix the above method you still don't see
any tool tips.

I can't find it documented anywhere (I didn't do an exhaustive search
though) but it appears that the method that Dolphin uses to draw the
StatusBarItems, using the SBT_OWNERDRAW style, is not compatible with the
use of ToolTips [1]. I came to this conclusion as I found that making a
small modification to one method, so that Windows became responsible for
drawing the StatusBar, made ToolTips work correctly.  The downside is that
you no longer get Icons displayed and there may well be other differences
that I didn't spot.

The change is very simple, just the above fix to #getTipText and the
following modification.

StatusBar>>setText: aStatusOwnerDraw
    | index text |
    index := self indexOfItem: aStatusOwnerDraw.
    text := aStatusOwnerDraw model isNil
        ifTrue: [String new]
        ifFalse: [aStatusOwnerDraw model value].
    (self
        sendMessage: SB_SETTEXT
        wParam: (aStatusOwnerDraw border | index-1)
        lParam: text yourAddress) == 0
            ifTrue: [^self errorInCommonControlCall].

Be careful though as I haven't fully tested it.

Ian

[1] It does make some sense though as the ToolTip is only displayed in
certain circumstances, mainly when the text is too wide to fit in the status
box. If Windows doesn't know what text is being displayed, because the view
was drawn by Dolphin, then it won't know whether to pop up the ToolTip or
not?


Reply | Threaded
Open this post in threaded view
|

Re: How to set tip for a StatusBarItem?

Dmitry Zamotkin-3
Hello Ian,

"Ian Bartholomew" <[hidden email]> wrote in message
news:9jq8kd$12m0l$[hidden email]...
> Dmitry,
>
> > I have tried to use StatusBar>>setItem:tipText: but without any results.
>
> I had a look at this and came up with the following ...
>
> There is one error (at least) as StatusBarItem>>getTipText should answer a
> String rather than self as it does at the moment - a missing ^.


OK, I fix it


> The bad news is that even if you do fix the above method you still don't
see
> any tool tips.


:-(


> I can't find it documented anywhere (I didn't do an exhaustive search
> though) but it appears that the method that Dolphin uses to draw the
> StatusBarItems, using the SBT_OWNERDRAW style, is not compatible with the
> use of ToolTips [1]. I came to this conclusion as I found that making a
> small modification to one method, so that Windows became responsible for
> drawing the StatusBar, made ToolTips work correctly.  The downside is that
> you no longer get Icons displayed and there may well be other differences
> that I didn't spot.
>
> The change is very simple, just the above fix to #getTipText and the
> following modification.
>
> StatusBar>>setText: aStatusOwnerDraw
>     | index text |
>     index := self indexOfItem: aStatusOwnerDraw.
>     text := aStatusOwnerDraw model isNil
>         ifTrue: [String new]
>         ifFalse: [aStatusOwnerDraw model value].
>     (self
>         sendMessage: SB_SETTEXT
>         wParam: (aStatusOwnerDraw border | index-1)


If you write like in an original method:
            wParam: (aStatusOwnerDraw border|SBT_OWNERDRAW|index-1)
icons will be displayed!


>         lParam: text yourAddress) == 0
>             ifTrue: [^self errorInCommonControlCall].
>
> Be careful though as I haven't fully tested it.
>
> Ian
>
> [1] It does make some sense though as the ToolTip is only displayed in
> certain circumstances, mainly when the text is too wide to fit in the
status
> box. If Windows doesn't know what text is being displayed, because the
view
> was drawn by Dolphin, then it won't know whether to pop up the ToolTip or
> not?
>

Anyway, it does not work... Thanks, Ian, for your comments, now I khow the
way to go on.


--
Dmitry Zamotkin