Is each ScreenTip cached?

3 posts, 1 answers
  1. xclirion
    xclirion avatar
    23 posts
    Member since:
    May 2010

    Posted 11 Aug 2010 Link to this post

    Hi,

    I have a GridView and when someone hovers over a cell a ScreenTip is displayed with some more informations. Works good, but now there was a need to add a button where the user can turn off these ScreenTips. And surprisingly even after turning them of some ScreenTips are still getting displayed. For us it seems that all ScreenTips which have been already displayed seems to get displayed without calling the ScreenTipNeeded Event.

    How can I change this behaviour?

    Thanks,
    Michael
  2. Answer
    Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 16 Aug 2010 Link to this post

    Hello Michael Topf,

    Thank you for writing.

    I am not sure how exactly you have implemented the adding of ScreenTips in your project. If you create a ScreenTip reference in ScreenTipNeeded event, it will remain even after you have unsubscribed from the event. You can turn off the screen tips by using a flag and the ScreenTipNeeded event. Please consider the following code as example:

    bool _screenTipsOn = true;
    void radGridView1_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e)
    {
        if (_screenTipsOn)
        {
            RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement();
            GridDataCellElement cell = e.Item as GridDataCellElement;
            if (cell != null)
            {
                screenTip.MainTextLabel.Text = cell.Value.ToString();
            }
            cell.ScreenTip = screenTip;
        }
        else
        {
            RadScreenTipElement element = e.Item.ScreenTip;
            if (element != null)
            {
                e.Item.ScreenTip = null;
                element.Dispose();
            }
        }
    }
    private void radButton1_Click(object sender, EventArgs e)
    {
        _screenTipsOn = !_screenTipsOn;
    }

    I hope this helps. Let me know if you have any additional questions.

    Sincerely yours,
    Martin Vasilev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. xclirion
    xclirion avatar
    23 posts
    Member since:
    May 2010

    Posted 17 Aug 2010 Link to this post

    Hello Martin,

    thanks, that was the solution.

    Michael
Back to Top