Tooltips and toolbars in MFC, or: why my life sucks right now.

Started by
26 comments, last by felisandria 19 years, 10 months ago
OK, a simple, pure Win32 (absolutely no MFC) example demonstrating tooltips on the main window, a child dialog, a check box, and a button is up. Source code and an executable.

Just click go to my main homepage, and go to the download section. If anyone is interested in any other Win32 code examples, just ask.

My homepage at school.
Advertisement
Cheers - looking at it now.
AARRRGGH

These &*("ing tooltips do my head in. Now the checkboxes and buttons work, but the labels dont. Presumably something to do with labels forwarding all messages to the parent window.....

Thanks anyway, I should be able to get this working now.... If I can just figure out how to fix this problem cleanly.
I had a problem similar to Felisandria''s one. My TTN_NEEDTEXT handler in CFrameWnd-derived class was not called after mouse cursor had been moved upon a toolbar button.

The solution was to write
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, YourHandlerName)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, YourHandlerName)
instead of
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, YourHandlerName)
in CFrameWnd-derived class'' message map.
What sometimes helps is to have a PreTranslateMessage and call RelayEvent for the tooltip control.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

quote:Original post by felisandria
I liberally sprinkled TTN_NEEDTEXT handlers throughout every view and frame that this toolbar gets anywhere near, and none of them get hit, at all *sigh*

I don''t know where it''s routing, or even IF it''s routing. Command messages work fine, tooltip notification is apparently nonexistent.

-fel


Let''s get back on topic - it seems your thread has been hijacked; I am assuming that you have covered all the obvious things:

1) Creating the toolbar with TBSTYLE_TOOLTIPS - the toolbar should then create it''s own tooltip control so you shouldn''t have to worry about message routing etc.

2) You have called EnableToolTips

3) You have handlers for TTN_NEEDTEXTA and TTN_NEEDTEXTW

Failing that I don''t know what could be the problem without seeing the code.


"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
I eventually fixed that... don''t really remember what I did... actually I don''t even work at that company anymore hehe. Original post is over 2 years old.

So, needless to say, hijacking is not a big deal at this time.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
we also suffer from this tooltip problem.
there was a groupbox, and some bitmap button within it.
the real suck is if the TAB ORDER of the group box is less than that of the button, then the button never will get the TTN_NEEDTEXT message... the groupbox silently swallows it...
nightmare MFC...

This topic is closed to new replies.

Advertisement