Note that there are some explanatory texts on larger screens.

plurals
  1. POChange tooltip control
    text
    copied!<p>I have a series of <code>textboxes</code> with which I want to associate a <code>tooltip</code> with. This <code>tooltip</code> would appear when the user clicks on a black <code>textbox</code>, then disappear when they start typing or when they leave the <code>textbox</code>. The <code>tooltip</code> should be placed directly above the <code>textbox</code>, this is why I'm using the <code>ToolTip.Show</code> method instead of the <code>ToolTip.SetTooltip</code> method (it lets me control the placement).</p> <p>So far, for each <code>textbox</code> I have 3 methods; Enter, Leave and TextChanged:</p> <pre><code>tt = new ToolTip(); String message = "some message"; //different for each textbox private void textbox1_Enter(object sender, EventArgs e) { if (textbox1.Text == String.Empty) { tt.Show(message, textbox1, new Point(0, -2 * textbox1.Height)); } } private void textbox1_Leave(object sender, EventArgs e) { tt.Hide(textbox1); } private void textbox1_TextChanged(object sender, EventArgs e) { tt.Hide(textbox1); } </code></pre> <p>Now consider two <code>textboxes</code>. Clicking on <code>textbox1</code> triggers the <code>tooltip</code> as expected, in the expected location, then exiting <code>textbox1</code> causes it to disappear. Trying the same thing on <code>textbox2</code> also works. Now if I click on <code>textbox1</code> again, the <code>tooltip</code> has the proper message, but the placement is in the same place as if I had clicked on <code>textbox2</code>. Not only that, but the shape of the <code>tooltip</code> is the same as for <code>textbox2</code>, meaning that my message gets truncated. (The message for <code>textbox1</code> is longer than the one for <code>textbox2</code>). Does anyone know what might be causing this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload