15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


tooltips: 2 questions

Douglas Earl -- dae@Rational.COM
Monday, June 24, 1996

VC++ 4.1 / Win 95

Question 1: tooltips stop working - why?
I'm trying to implement tooltips for an edit control in a control bar.  =
I've taken the steps outlined in "Programming with MFC: Encyclopedia" =
from Books Online 4.1.  That is, call EnableToolTips for my control bar =
and provide a handler for TTN_NEEDTEXT.  Everything works great until I =
do a mouse operation in my application's main window.  From that point =
on, the tooltip fails to display for the control until I bring up a =
different tooltip (e.g. on the toolbar).  This sounds suspiciously like =
a problem outlined in the KnowledgeBase (Tool Tips Stop Showing After =
WM_xBUTTONDOWN - Q148495), however I don't see how it relates since they =
assume I have my own tool tip control, which is not the case since I'm =
letting MFC handle everything (via EnableToolTips).  Am I truly doing =
something wrong with my WM_xBUTTON handlers?  Is there a workaround =
(preferably one that doesn't access MFC private code) that would force =
MFC to think this was a new tooltip each time? (tooltips works if =
CWnd::FilterToolTipMessage thinks this is a different tooltip "hit" than =
the previous one).

Question 2: TTN_NEEDTEXT vs. TTN_NEEDTEXTA and TTN_NEEDTEXTW
While debugging a different problem with the toolbar, I noticed that I =
received TTN_NEEDTEXTA notification on Win95 and TTN_NEEDTEXTW on NT =
3.51.  Does this mean everywhere I want to process TTN_NEEDTEXT I have =
to process the A and W versions instead if I want to be multi-platform?

Thanks,
Doug



Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com
Thursday, June 27, 1996

> TTN_NEEDTEXT vs. TTN_NEEDTEXTA and TTN_NEEDTEXTW
>While debugging a different problem with the toolbar, I noticed that I 
received TTN_NEEDTEXTA notification on Win95 and >TTN_NEEDTEXTW on NT 3.51.  
Does this mean everywhere I want to process TTN_NEEDTEXT I have to process the 
A >and W versions instead if I want to be multi-platform?

Look in winfrm.cpp. There they check for both ansi or unicode messages,
and go through a series of #ifdefs. If you want to be multi-platform, you would 
want
a Unicode version of your app to run under NT, and an Ansi Version for 95.
As such, since the app is 2 different binaries, use "TTN_NEEDTEXT". 
That way, the code itself doesn't change, you just compile one version with 
_UNICODE
#defined for NT, and another version for 95 without _UNICODE #defined.
Of course, if you run the 95 version of your app under NT, the tooltips won't 
be there.
The important thing is that there is one source code version for both platforms.

mcontest@universal.com






| Вернуться в корень Архива |