tooltips on dialog bar
Harry Hahne -- hahne@epas.utoronto.ca
Monday, July 22, 1996
Environment: VC++ 4.1, Windows 95:
Is there any way to set up tooltips on buttons located on a dialog bar? I
would also like the status bar message to change as a user passes the mouse
over these buttons.
Harry Hahne
Anujit Sarkar -- anujit@vedika.ernet.in
Friday, July 26, 1996
[Mini-digest: 3 responses]
> Environment: VC++ 4.1, Windows 95:
>
> Is there any way to set up tooltips on buttons located on a
> dialog bar? I
> would also like the status bar message to change as a user passes
> the mouse
> over these buttons.
>
> Harry Hahne
>
>
Enter into the string table the message you want to show in the
CAPTION part and the id of the control for which you want to
display the message in the ID part.The message should be preceded
by a \n.If you want to show a more detailed message on the status
bar as well ,put it in the CAPTION part followed by a \n followed
by the tooltip message.
e.g.
If you have a radio button with ID IDC_RADIO1 in the dialog bar
the string table should look something like this
----------------------------------------------------
ID VALUE CAPTION
----------------------------------------------------
IDC_RADIO1 .... This is Radio Button1 \n Radio Button1
| |
status bar message tooltip message
See CTRLBAR sample in MSDEV.
-------------------------------------------------------------------
Anujit Sarkar(e-mail address:anujit@vedika.ernet.in)
-------------------------------------------------------------------
Resi: 102 Southern Avenue Office:Vedika International
'Sarobar' 7 N.E. 21 Lansdowne Court
Calcutta -700029 5B Sarat Bose Road
INDIA Calcutta-700020 INDIA
Phone No.+91-33-4661473 Phone No.+91-33-2473810
-------------------------------------------------------------------
-----From: "Anthony DiBlasio"
Adding tooltips to controls on a dialog bar is the same as adding the tooltips
to a toolbar. To enable them you must create the dialog bar with the
CBRS_TOOLTIPS style.
-----From: drt@ebt.com (Randy Taylor)
Environment: VC++ 4.1, Windows 95:
>
>Is there any way to set up tooltips on buttons located on a dialog bar?
Me too. I have a CStatic derivative on a CDialogBar. I also
have a handler for the needtext message in the static:
... // note my frame sends a WM_USER message to the window to determine
// if that window is tool-tip capable:
BOOL myFrame::OnToolTipText(UINT msg, NMHDR* pNMHDR, LRESULT* pResult)
{
// snip, snip - code ommitted.
if (pTTTA->uFlags & TTF_IDISHWND) {
// idFrom is actually the HWND of the tool
nID = _AfxGetDlgCtrlID((HWND)nID);
if (nID == AFX_IDW_TOOLBAR)
; // message handled below
else {
CWnd* wnd = CWnd::FromHandlePermanent((HWND)pNMHDR->idFrom);
TCHAR *pText = NULL;
POINT pt = GetCurrentMessage()->pt;
// WM_USER TO ASK WINDOW IF IT DOES TOOLTIPS
wnd->SendMessage(WM_USER_TTNEEDTEXT, (WPARAM)&pt, (LPARAM) &pText);
if (pText) {
_tcsncpy(pTTTA->szText, pText, sizeof pTTTA->szText);
return TRUE;
}
else
return FALSE;
}
}
// snip, snip
}
... // Note: I enabled TOOL tips for both the static and the dialog bar.
myStatic.EnableToolTips(TRUE);
myDialogBar.EnableToolTips(TRUE);
... // Note: I have a handler for my WM_USER message
LRESULT myStatic::OnTTNeedText(WPARAM, LPARAM lParam)
{
// WM_USER_TTNEEDTEXT handler
TCHAR** ppStr = (TCHAR**) lParam;
*ppStr = &(m_buffToolTip[0]);
return 1; // handled
}
===============
Is there something that I'm just not understanding here?
Randy Taylor
drt@ebt.com
| Вернуться в корень Архива
|