This is a migrated thread and some comments may be shown as answers.

ToolTip does not work on RadTextBox

8 Answers 923 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Skywalker
Top achievements
Rank 1
Skywalker asked on 21 Nov 2007, 06:10 PM
Hi,

When I attach a ToolTip (System.Windows.Forms.ToolTip) to a RadTextBox, the ToolTip won't show up. When I attach the same ToolTip to the intrinsic TextBox (System.Windows.Forms.TextBox), the ToolTip works fine.

Is this a bug, or am I missing something?

Thanks,

8 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 23 Nov 2007, 09:42 AM
Hi Sipke,
We have our own tooltip mechanism and it looks like it overrides the default one. You can use ours instead, it is just the same. To do so you can use the following code:

        private void Test_Load(object sender, EventArgs e)  
        {  
            this.radTextBox1.ButtonElement.ToolTipText = "test";  
        } 

or

this.radTextBox1.ToolTipTextNeeded += new Telerik.WinControls.ToolTipTextNeededEventHandler(this.radTextBox1_ToolTipTextNeeded);  
 
private void radTextBox1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)  
{  
    this.radTextBox1.ButtonElement.ToolTipText = "test";  


All the best,
Dimitar Kapitanov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Skywalker
Top achievements
Rank 1
answered on 23 Nov 2007, 10:33 PM
Hi Dimitar,

RadTextBox doesn't seem to have a ButtonElement property, but I did find the RootElement property, which in turn does have a ToolTipText property.
However, when I set this property to a string, still no tooltip will show up.

Your second suggestion also doesn't quite work, but I guess you meant to set the ToolTipText of the event argument ToolTipTextNeededEventArgs, which does work.

Although handling the event works fine, I think it would be better if we could just set a ToolTipText property. The RootElement has this property, but somehow it doesn't display the Tooltip. Unless we handle the ToolTipTextNeeded event.

In any case, thank you for the quick reply. It helped me figuring out how to make tooltips work :)

Kind regards,

Sipke
0
Skywalker
Top achievements
Rank 1
answered on 23 Nov 2007, 10:54 PM
Hi Dimitar,

When I handle the event ToolTipTextNeeded for a RadTextBox control, the argument 'sender' is of type RadTextBoxItem, instead of RadTextBox. How does that work? The RadTextBoxItem class has a AutoToolTip property, but I can't set this through the RadTextBox object instance. What is the relation between a RadTextBox and a RadTextBoxItem? Does RadTextBox 'own' a RadTextBoxItem object? If so, could it be possible to reference this object, so that I for example could set AutoToolTip to true?

Thanks,
0
Dimitar Kapitanov
Telerik team
answered on 26 Nov 2007, 12:01 PM

Hi Sipke,
First some comments regarding the architecture. We have a non windowed (without associated window handle) hierarchy of objects, and in the case of our RadTextBox it looks like:

RadTextBox > RootElement > RadTextBoxElement > RadTextBoxItem.

What you really need is to work with the lowest level, the  RadTextBoxItem which implements all key features.
I apologize for the incorrect code snippets in my previous answer, let me clarify the proper way at the moment:

((RadTextBoxElement)this.radTextBox1.RootElement.Children[0]).TextBoxItem.AutoToolTip = true
 
((RadTextBoxElement)this.radTextBox1.RootElement.Children[0]).TextBoxItem.ToolTipText = "test";  




Kind regards,
Dimitar Kapitanov
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
0
Skywalker
Top achievements
Rank 1
answered on 26 Nov 2007, 01:18 PM
Hi Dimitar,

Ah I see, that makes many things more clear. :)
Nice architecture. So I could assign a tooltip to each individual element of a control. I could attach a tooltip to the dropdownbutton of a combobox, and yet another tooltip to the TextBox element of the same combobox.

Thank you very much for your feedback.

Cheers,
Sipke
0
Michael
Top achievements
Rank 1
answered on 03 Apr 2012, 12:49 PM
Hi guys,
is there any way to customise the look (IsBaloon,TooltipIcon, Colors) and behavior (Active, InitialDelay, ShowAlway) for the Telerik internal tooltip? I coudld also need a maximum length and text wrap for a tooltip.
I was struggeling to get a language based tooltip text before and solved like described  here:
http://www.telerik.com/community/forums/winforms/ribbonbar/iterate-trough-radribbonbar.aspx
Therefore the solition should be without ToolTipTextNeeded event.

If this is not possible, is there a way to get the standard winforms tooltip to work with RadTextBox etc..?

many thanks,
-Michael
PS: I wished we had the same possibilities in winforms as with RadToolTip for asp.net/ajax.

0
Stefan
Telerik team
answered on 05 Apr 2012, 11:12 AM
Hello Michael,

Thank you for writing.

No matter which tool tip you are using (the ToolTipText property of the ToolTipTextNeeded event), the standard .NET framework ToolTip  is used internally. Here is how to access its instance in order to customize it:
radRibbonBar1.Behavior.ToolTip.ToolTipIcon = ToolTipIcon.Error;

I hope that this information addresses your question. Let us know if you have any other questions.
 
Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Michael
Top achievements
Rank 1
answered on 12 Apr 2012, 08:50 AM
Thank you. That brings me  a step forward.

-Michael
Tags
TextBox
Asked by
Skywalker
Top achievements
Rank 1
Answers by
Dimitar Kapitanov
Telerik team
Skywalker
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or