Click to See Complete Forum and Search --> : ToolTips


James Atkinson
April 20th, 1999, 11:56 PM
Hi all. I'm doing a small Tic-Tac-Toe program for the final project in a Windows C Programming class. Everything works fine except for the ToolTips for my ToolBar. I"ve read all the help files information and a bunch of stuff from msdn.microsoft.com, however all of it goes over my head.... any help or advice anyone can give would be great Thnx :)

- James

Chris Wheeler
April 21st, 1999, 08:21 AM
If you know this, I'm sorry, I just picked a starting point. Most toolbar buttons are tied to a menu item. I'm assuming yours are. In the menu editor, bring up the properties of the menu item or in the toolbar editor, bring up the properties of the toolbar button. The "Prompt" is the text that shows up in the Status Bar. To put tooltip text in, put a \n immediately after the prompt text and type the toolbar text. Like this: Open the Query Builder\nQuery Builder "Query Builder" will be the tooltip. Hope this helps. If you've already tried it, I don't really know.

Chris R. Wheeler, MCP
Pensacola Christian College
Desktop Programmer
cwheeler@pcci.edu

eric33
April 22nd, 1999, 06:10 AM
If your problem is that tooltips do not display on a toolbar, i found a solution in my own MFC application.

First you must declare a notification handler in the container frame (mainframe) as this :
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT,0,0xFFFF,OnToolTipNotify)

Then you must develop the handler as this :

BOOL CMainFrame::OnToolTipNotify(UINT id, NMHDR *pNMH, LRESULT *pResult) {

//pNMH->idFrom contains the id of the toolbar control

int i;

// You can for example verify if one of the item of the toolbar has the same id
for ( i=0; i<m_ToolBar.GetCount(); i++ )
{
if ( m_ToolBar.GetItemID(i)==pNMH->idFrom )
{
// Return the text of the tooltip
pText->lpszText = MAKEINTRESOURCE(pNMH->idFrom);
pText->hinst = AfxGetInstanceHandle();
return TRUE;
}
return FALSE;
}

I hope this can help you.