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

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


CDialogBar & ToolTips

Jeffrey Smith -- wyvern@msn.com
Friday, September 20, 1996

Environment: VC++ 4.2, Win 95

Problem:
I'm trying to get tool tips using a CDialogBar derived class using a dialog 
with only static text controls. My OnToolTipNotify handler in this derived 
class never gets called.

What I've done:
1. 	Override Create() and or'd CBRS_FLYBY | CBRS_TOOLTIP to the create flags.
2. 	Called EnableToolTips( TRUE );
3. 	Added ON_NOTIFY_EX_RANGE( TTN_NEEDTEXT, 0, 0xFFFF, OnToolTipNotify )
4. 	EnableDocking() for the object and docked the CDialogBar using 
DockControlBar().
5. 	Override int CDockView::OnToolHitTest( CPoint point, TOOLINFO* pTI ) 
const. I called the CDialogBar::OnToolHitTest() and checked to see if hit 
testing was working and my controls were being identified. They were.
6. 	In OnToolHitTest() I checked to see if LPSTR_TEXTCALLBACK was set in the 
TOOLINFO* struct and if hwnd member was the handle to my derived class. They 
were.
7. 	Also in OnToolHitTest() check to see if TTF_SUBCLASS was set in the flags 
for TOOLINFO*. It was not.

Questions:
1.	Since TTF_SUBCLASS  was not set, the docs indicate I need to send 
TTM_RELAYEVENT?  If so, where should I do this in the code?
2. 	Am I off course? Any other ways to get my OnToolTipNotify to be called?

Thanks,
Jeff Smith




Mark Conway -- mrc@mfltd.co.uk
Tuesday, September 24, 1996

Jeremy, this may not be what you want, but if you just want to add
fairly standard static text tooltips to a dialog bar, you can:
1) Choose unique ID's for the controls in the dialog bar.
2) Have string table entries for these ID's in your resource file, just
as you would for a toolbar (ie \n seperating status bar from tooltip
text)
3) Create the dialogbar with CBRS_FLYBY and CBRS_TOOLTIP - don't use
EnableToolTips(TRUE)

Mark.

>----------
>From: 	Jeffrey Smith[SMTP:wyvern@msn.com]
>Sent: 	20 September 1996 07:15
>To: 	MFC List - Submit
>Subject: 	CDialogBar & ToolTips
>
>Environment: VC++ 4.2, Win 95
>
>Problem:
>I'm trying to get tool tips using a CDialogBar derived class using a
>dialog 
>with only static text controls. My OnToolTipNotify handler in this
>derived 
>class never gets called.
>
>What I've done:
>1. 	Override Create() and or'd CBRS_FLYBY | CBRS_TOOLTIP to the create
>flags.
>2. 	Called EnableToolTips( TRUE );
>3. 	Added ON_NOTIFY_EX_RANGE( TTN_NEEDTEXT, 0, 0xFFFF, OnToolTipNotify
>)
>4. 	EnableDocking() for the object and docked the CDialogBar using 
>DockControlBar().
>5. 	Override int CDockView::OnToolHitTest( CPoint point, TOOLINFO* pTI
>) 
>const. I called the CDialogBar::OnToolHitTest() and checked to see if
>hit 
>testing was working and my controls were being identified. They were.
>6. 	In OnToolHitTest() I checked to see if LPSTR_TEXTCALLBACK was set
>in the 
>TOOLINFO* struct and if hwnd member was the handle to my derived class.
>They 
>were.
>7. 	Also in OnToolHitTest() check to see if TTF_SUBCLASS was set in the
>flags 
>for TOOLINFO*. It was not.
>
>Questions:
>1.	Since TTF_SUBCLASS  was not set, the docs indicate I need to send 
>TTM_RELAYEVENT?  If so, where should I do this in the code?
>2. 	Am I off course? Any other ways to get my OnToolTipNotify to be
>called?
>
>Thanks,
>Jeff Smith
>
>




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