CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2008
    Posts
    214

    C++ Winapi - Tooltip / Listview Items

    Ive created a tooltip control and can add tooltips by looping through all items of a listview in WM_CREATE. I use ListView_GetItemRect(p) within a for statement that loops through the total number of items "i".

    But, when the tooltips show up, it only shows the first 10 items text. It doesn't matter if I am at the bottom of the listview or not.

    Code:
        ti.cbSize = sizeof(TOOLINFO);
        ti.uFlags = TTF_SUBCLASS;
        ti.hwnd = GetDlgItem(hwnd, listview);
        ti.hinst = NULL;
    
        reverse(DisplayName.begin(), DisplayName.end());
        for(p = 0; p < i; p++)
        {
        string aReg = DisplayName[p]; //+ CompanyName
        ti.lpszText = (CHAR*)aReg.c_str();
        ListView_GetItemRect(GetDlgItem(hwnd, listview), p, &ti.rect, LVIR_BOUNDS);
    
        SendMessage(tooltip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
        SendMessage(tooltip, TTM_ACTIVATE, TRUE, 0);
        SendMessage(tooltip, TTM_SETMAXTIPWIDTH, 0, 5000);
        }
    Last edited by zaryk; May 15th, 2009 at 04:59 PM.

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