CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: ToolTips

  1. #1
    Join Date
    Apr 1999
    Posts
    1

    ToolTips

    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


  2. #2
    Join Date
    May 1999
    Posts
    28

    Re: ToolTips

    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
    [email protected]

  3. #3
    Join Date
    May 1999
    Posts
    318

    Re: ToolTips

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured