Results 1 to 8 of 8

Thread: Displaying tooltip of contents in a grid cell

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    5

    Displaying tooltip of contents in a grid cell

    Hi All,

    I am using the Objective Grid to display contents in an excel format using Stingray and I need to display the contents of a cell as a tooltip when I hover the mouse on that cell.

    Can anyone please suggest a mechanism to display the tooltip? Are there some existing API's which I need to use? Or, do I need to do some custom drawing to handle the issue?

    Thanks in advance,

    sb

  2. #2
    Please, see CGXGridCore::EnableGridToolTips in OG Class reference

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    5
    Hi Boris,

    It would be quite helpful if you can post some code snippet on what needs to be done. I couldnt find any info about CGXGridCore::EnableGridToolTips in OG class reference.

    Thanks,

    sb

  4. #4
    This is from Class Reference

    CGXGridCore::EnableGridToolTips
    BOOL EnableGridToolTips(BOOL b = TRUE);

    b

    TRUE for enabling tool-tips; FALSE to turn them off.

    Return Value
    TRUE if tooltips are supported; FALSE if initialization failed.

    Remarks
    To enable tooltips for cells you have to call

    EnableGridToolTips();
    at initialization time of the grid (e.g., OnInitialUpdate or OnInitDialog).

    You also have to register a user attribute that lets you specify the tooltip text for the cell.

    The user attribute can be registered with

    stylesmap = GetParam()->GetStylesMap();

    // Tooltips
    stylesmap->AddUserAttribute(GX_IDS_UA_TOOLTIPTEXT,
    CGXStyle().SetWrapText(TRUE).SetAutoSize(TRUE));
    You can then apply tooltips to specific cells with SetStyleRange.

    Example:

    SetStyleRange(CGXRange().SetCols(1), CGXStyle()
    .SetUserAttribute(GX_IDS_UA_TOOLTIPTEXT, _T("Column 1")));

    SetStyleRange(CGXRange().SetCols(2), CGXStyle()
    .SetUserAttribute(GX_IDS_UA_TOOLTIPTEXT, _T("Column 2")));

    SetStyleRange(CGXRange().SetCols(3), CGXStyle()
    .SetUserAttribute(GX_IDS_UA_TOOLTIPTEXT, _T("Column 3")));

    If you want to supply the tooltip information at run time, you should override GetStyleRowCol and call style.SetUserAttribute.

    Note

    Tooltips are only supported for MFC Version 4.0 or later!

    Control Factory Specfic ->

    You don't need to manually enable tool-tips for individual grids. If you select "Tool-tips" in the Objective Grid Build Wizard or Factory Wizard, tool-tips will be automatically enabled for all grids.

    Also, the user attribute will automatically be registered.

    END Control Factory Specfic

    Example
    This example shows you how enable tooltip support.

    a) In a GridView

    void CMyGridView::OnInitialUpdate()
    {
    EnableGridToolTips ();

    ...
    }

    b) From OnInitDialog in a dialog

    BOOL CSample1Dialog::OnInitDialog()
    {
    CDialog::OnInitDialog();

    GetGridWnd()->Initialize();

    ....

    GetGridWnd()->EnableGridToolTips();

    return TRUE; // return TRUE unless you set the focus to a control
    }
    See Also
    CGXStyle::SetUserAttribute

  5. #5
    Junior Member
    Join Date
    Mar 2009
    Posts
    5
    Quote Originally Posted by sb2k9 View Post
    Hi All,

    I am using the Objective Grid to display contents in an excel format using Stingray and I need to display the contents of a cell as a tooltip when I hover the mouse on that cell.

    Can anyone please suggest a mechanism to display the tooltip? Are there some existing API's which I need to use? Or, do I need to do some custom drawing to handle the issue?

    Thanks in advance,

    sb
    Hi Boris,

    Thanks for the detailed explanation. It has certainly worked for my case. However, I am still having an issue with displaying the tooltips as a multi-line text form. I have included the "\r\n" characters in the text but havent been able to display it.

    Can you please provide some information about this?

    Thanks,

    sb

  6. #6
    Please, see sample(rightmost tab)
    \Samples\Grid\General\CellTipDemo
    TS (support@roguewave.com) can also provide an additional sample on request

  7. #7
    Junior Member
    Join Date
    Nov 2014
    Posts
    1
    Hi,

    I have class derived from CGXBrowserWnd and I need to add tooltip. I have done all steps mentioned above, but tooltip is not displayed.

    Any information would be helpful.

    Thanks,
    Iftikhar

  8. #8
    The question is good. Very relevant. Please visit any college paper writing service for the answer.

Posting Permissions

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