Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Tooltip text in CFormView

Tooltip text in CFormView

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    ledallam
    wrote on last edited by
    #1

    Hi I am trying to display tool tip text on icons placed on CFormView. I am using these functions: ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) BOOL CDashboardView :: OnToolTipText (UINT id, NMHDR *pNMHDR, LRESULT *pResult) { BOOL result = TRUE; /* Operation result */ CString strTipText; /* tool tip text */ UINT nID = -1; /* Identifier */ TOOLTIPTEXTA* pTTTA = NULL; TOOLTIPTEXTW* pTTTW = NULL; CPoint point; /* current cursor point */ pTTTA = (TOOLTIPTEXTA*)pNMHDR; pTTTW = (TOOLTIPTEXTW*)pNMHDR; nID = pNMHDR->idFrom; if (nID != 0 ) { // Identify button rect, copy text for (long ii = 0; ii < m_arrLineupBtnRect.GetSize(); ii++) { GetCursorPos (&point); ScreenToClient (&point); if (m_arrLineupBtnRect[ii].PtInRect(point)) { strTipText = m_sButtLineups[ii].m_strToolTip; } } // Copy tool tip text if (pNMHDR->code == TTN_NEEDTEXTA) { lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength()); } else { _mbstowcsz(pTTTW->szText, strTipText,strTipText.GetLength()); } *pResult = 0; } return result; } My problem is that the tool tip text has about 280characters. The program crashes at the line lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength()); It works fine for about 80 characters in tool tip text. Is there any limit for the tool tip text. Thanks Madhavi

    H 1 Reply Last reply
    0
    • L ledallam

      Hi I am trying to display tool tip text on icons placed on CFormView. I am using these functions: ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText) ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText) BOOL CDashboardView :: OnToolTipText (UINT id, NMHDR *pNMHDR, LRESULT *pResult) { BOOL result = TRUE; /* Operation result */ CString strTipText; /* tool tip text */ UINT nID = -1; /* Identifier */ TOOLTIPTEXTA* pTTTA = NULL; TOOLTIPTEXTW* pTTTW = NULL; CPoint point; /* current cursor point */ pTTTA = (TOOLTIPTEXTA*)pNMHDR; pTTTW = (TOOLTIPTEXTW*)pNMHDR; nID = pNMHDR->idFrom; if (nID != 0 ) { // Identify button rect, copy text for (long ii = 0; ii < m_arrLineupBtnRect.GetSize(); ii++) { GetCursorPos (&point); ScreenToClient (&point); if (m_arrLineupBtnRect[ii].PtInRect(point)) { strTipText = m_sButtLineups[ii].m_strToolTip; } } // Copy tool tip text if (pNMHDR->code == TTN_NEEDTEXTA) { lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength()); } else { _mbstowcsz(pTTTW->szText, strTipText,strTipText.GetLength()); } *pResult = 0; } return result; } My problem is that the tool tip text has about 280characters. The program crashes at the line lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength()); It works fine for about 80 characters in tool tip text. Is there any limit for the tool tip text. Thanks Madhavi

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      I searched codeproject and found two articles World's Easiest Way to Create Multi-Line Tooltips[^] but this articles is for VB.NET it calculates length of tooltip and then split to lines,but other articles is with C++ CPPToolTip v2.1[^] I guess maybe it will be helpful for you.:)


      WhiteSky


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups