Gantt Chart, tool tips for push buttons?

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

Gantt Chart, tool tips for push buttons?

Christopher J. Demers
I have made a simple Gantt chart presenter.  I used push buttons for the
blocks because that seemed easy.  In some cases the text does not fit in the
button and is truncated.  I would like to have tool tips pop up so the full
text can be read.  Does anyone know of a quick and easy way to get tool tips
working on push buttons?   My heart is not set on push buttons, so I can use
anything else that might work easily.  I know tool bar stuff seems to
support tips, but I don't think a tool bar would give me enough format
latitude for the chart, and I don't even know if I can (ab)use them for that
purpose.  View<<toolTipWindow: looked interesting, but it is not referenced
in the image so I don't know how to (or if I can) use it for anything.

I can fake this if I have to, I just want to see if there is an easy and
elegant way to do this.


Chris


Reply | Threaded
Open this post in threaded view
|

Re: Gantt Chart, tool tips for push buttons?

Steve Alan Waring
Hi Chris,

Christopher J. Demers wrote:

> pop up so the full text can be read.  Does anyone know of a quick and
> easy way to get tool tips working on push buttons?

It is a hack, but check out:

   http://www.stevewaring.net/blog/articles/ToolTipResuse.html

FWIW: Unlike the article suggests, it is just as easy to create a new
ToolTip view as reusing one. See the recent "Evaluating Dolphin" thread, and
the code posted by mm_aa.

Steve
--
Steve Waring
Email: [hidden email]
Journal: http://www.stevewaring.net/blog/home/index.html


Reply | Threaded
Open this post in threaded view
|

Re: Gantt Chart, tool tips for push buttons?

Christopher J. Demers
"Steve Waring" <[hidden email]> wrote in message
news:b3htf1$1mcjvb$[hidden email]...
> > pop up so the full text can be read.  Does anyone know of a quick and
> > easy way to get tool tips working on push buttons?
>
> It is a hack, but check out:
>
>    http://www.stevewaring.net/blog/articles/ToolTipResuse.html
>

Awesome!  Thank you Steve and mm_aa.  This saved me a lot of work and got me
pointed in the right direction.  Bellow you will find my meager kludgy
contribution to this endeavor.  I added your methods to PushButton, and then
borrowed from mm_aa's approach and  added a method called
addToolTipToButton: to my presenter class that does what is says.  I added
support for multiple lines, as that is what I needed (apparently by setting
a max width you can use cr's to force new lines).

==================
addToolTipToButton: aPushButton
"cdemers - 2/26/2003 Add tool tip support to aPushButton. This is based on
code from Steve Waring and mm_aa."
| toolTipHandle toolInfo |
toolTipHandle := UserLibrary default
createWindowEx: 8 "WS_EX_TOPMOST"
lpClassName: 'tooltips_class32'
lpWindowName: nil
dwStyle: WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP
x: CW_USEDEFAULT
y: CW_USEDEFAULT
nWidth: CW_USEDEFAULT
nHeight: CW_USEDEFAULT
hWndParent: aPushButton handle
hMenu: nil
hInstance: VMLibrary default applicationHandle
lpParam: nil.
(toolInfo := TOOLINFO new)
uFlags: TTF_IDISHWND | TTF_SUBCLASS;
hwnd: aPushButton handle;
uId: aPushButton handle;
textCallback.
UserLibrary default sendMessage: toolTipHandle msg: 1028 "TTM_ADDTOOL"
wParam: 0 lParam: toolInfo yourAddress.
"cdemers - 2/26/2003 Allow multiline."
UserLibrary default sendMessage: toolTipHandle msg: 1048
"TTM_SETMAXTIPWIDTH" wParam: 0 lParam: 500.
==================

Chris