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

Thread: ToolTips

  1. #1
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    36

    ToolTips

    I need to create ToolTips in DialogBox
    My Dialog box contains:
    1)PushButtons
    2)CheckBoxes
    3)ComboBoxes

    I've done such thing:
    1)
    BOOL CMyDialogBox::OnInitDialog()
    {
    ......
    ......
    EnableToolTips(true)
    ......
    }

    2)
    BEGIN_MESSAGE_MAP (CMyDialog, CDialog)
    .....
    .....
    ON_NOTIFY_EX(TTN_NEEDTEXT,0,OnTTip)
    END_MESSAGE_MAP()

    3)
    BOOL CMyDialog::OnTT(UINTidFrom,NMHDR*hdr,LRESULT *ResultNotUsed)
    {
    TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)hdr;
    UINT nID = pTTT->hdr.idFrom;
    pTTT -> lpszText = "TEST";
    return(true);
    }

    It works for PUSH BUTTONS ONLY
    But it dosen't work for comboboxes,lables and checkboxes.
    Please help me.
    Thank you.
    Alex


  2. #2
    Join Date
    Jan 2000
    Location
    Portugal
    Posts
    239

    Re: ToolTips

    While there isn't a better answer, see if this helps:

    http://mfcfaq.stringray.com/


    --
    Nuno Tavares
    http://nthq.cjb.net
    Nuno Tavares
    "I live the way I type: fast, with a lot of errors"

  3. #3
    Guest

    Re: ToolTips

    Ther is some mistake I can't enter this www :-(


  4. #4
    Guest

    Re: ToolTips

    It works on NT…
    Try this (from my test program):


    BOOL CToolTipsDlg::OnTTip(UINT id, NMHDR* pNMHDR, LRESULT *pResult)
    {
    TOOLTIPTEXT *pTTT = (TOOLTIPTEXT*)pNMHDR;

    UINT nID = pNMHDR->idFrom;
    if ((pNMHDR->code == TTN_NEEDTEXT) && (pTTTA->uFlags & TTF_IDISHWND)
    {
    // idFrom is the HWND of the tool
    nID = ::GetDlgCtrlID((HWND)nID);
    }

    pTTT->lpszText = "TEST";

    return TRUE;
    }






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