0

I am trying to give the user an option to disable and enable the tool tips. In my application, I created a menu strip with two options (EnableToolTip/DisableToolTip). Here my code to set the tool Tips (where ttObj is a global object):

private void loadToolTips()
{

    ttObj.AutoPopDelay = 5000;
    ttObj.InitialDelay = 1000;
    ttObj.ReshowDelay = 500;

    ttObj.SetToolTip(this.btnSetRolesType, "A");
    ttObj.SetToolTip(btnCreateUser, "B");
    ttObj.SetToolTip(btnModifyNum, "C");
    ttObj.SetToolTip(btnFindDups, "D");
    ttObj.ShowAlways = false;

}

And this is where I am trying to disable the tooltips

private void enableToolStripMenuItem_Click(object sender, EventArgs e)
{
    enableToolStripMenuItem.Checked = true;
    disableToolStripMenuItem.Checked = false;
}

private void disableToolStripMenuItem_Click(object sender, EventArgs e)
{
    disableToolStripMenuItem.Checked = true;
    enableToolStripMenuItem.Checked = false;
    ttObj.Hide(this); //this doesn't do anything

}

There isn't much on google or stackoverflow. Some help is much appreciated.

1
  • Well, the enable menuitem doesn't do much either. Just dispose the tooltip, create it when it is enabled. Commented Jul 25, 2014 at 17:42

1 Answer 1

1

To enable/disable the tool tips, use the Active property. Set it False to disable and when you set it back to True, you'll have your tool tips again without having to re-add them.

private void enableToolStripMenuItem_Click(object sender, EventArgs e)
{
    enableToolStripMenuItem.Checked = true;
    disableToolStripMenuItem.Checked = false;

    ttObj.Active = true;
}

private void disableToolStripMenuItem_Click(object sender, EventArgs e)
{
    disableToolStripMenuItem.Checked = true;
    enableToolStripMenuItem.Checked = false;

    ttObj.Active = false;
}

Alternatively, to just wipe them out, use RemoveAll(). You'll have to re-run loadToolTips() to add them back.

private void disableToolStripMenuItem_Click(object sender, EventArgs e)
{
    disableToolStripMenuItem.Checked = true;
    enableToolStripMenuItem.Checked = false;

    ttObj.RemoveAll();   
}
Sign up to request clarification or add additional context in comments.

1 Comment

I guess when I enable them i have rebuild by running the rebuildtoolTip method?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.