Using a Callout as a Tooltip with an Embedded Label TextBox

1 Answer 46 Views
Callout TextBox
Dave
Top achievements
Rank 2
Iron
Iron
Veteran
Dave asked on 09 Jun 2023, 08:12 PM

I have a textbox with an embedded label and use a callout like a tooltip.   I saw your code from https://www.telerik.com/forums/using-callout-as-a-tooltip.

The process works fine when using a plain textbox but clicking in the eltextbox to select becomes an issue because the focused control keeps changing between the embedded label and the callout.  Is there a way to implement these two controls together? Constant clicking in the ELTextbox will eventually get it selected.

Attached is a sample project.

Thanks,

_Dave

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 14 Jun 2023, 12:24 PM

Hello David,

Thank you for the provided project.

The reported behavior is very interesting. When the RadCallout appears it will steal the focus. The RadTextBox will lose focus and the embedded label will go down. To be able to type in the text box you will need to click on the text box and the label inside will move to the top. However, again the RadCallout is stealing the focus which leads to a loop of events. I have searched for a possible solution but I wasn't able to make this work when the label inside is moving. What I can suggest is to disable the repositioning of the embedded label. To do that you can set the RepositionEmbeddedLabel property to false.

this.radTextBox1.TextBoxElement.RepositionEmbeddedLabel = false;

I hope that this approach will work for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Dave
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 21 Jun 2023, 09:38 PM

I applied the change.  Yes, it works, but the coolness factor is lost.  I might as well have used an oversized textbox with a label over the top.
Dinko | Tech Support Engineer
Telerik team
commented on 26 Jun 2023, 11:09 AM

I understand your concern. The described behavior is a current limitation of the approach of using RadCallout as a ToolTip in RadTextBox with EmbeddedLabel. The methods that move the label are not public which makes it hard to catch the exact moment for overriding this. You could try to disable the EmbeddedLabel animation when the RadCallout is visible and enabled it again after it is closed. You can do that in the GotFocus and LostFocus events of the RadTextBox.

private void RadTextBox1_GotFocus(object sender, EventArgs e)
{
    if (radCallout1.CalloutForm.Visible)
    {
        this.radTextBox1.TextBoxElement.RepositionEmbeddedLabel = false;
             
    }
    else
    {
        this.radTextBox1.TextBoxElement.RepositionEmbeddedLabel = true;
    }
}

private void RadTextBox1_LostFocus(object sender, System.EventArgs e)
{
    if (radCallout1.CalloutForm.Visible)
    {
        this.radTextBox1.TextBoxElement.RepositionEmbeddedLabel = false;
                
    }
    else
    {
        this.radTextBox1.TextBoxElement.RepositionEmbeddedLabel = true;
    }
}

The above code snippet will make using both controls are little more stable, however, it is still far from a perfect solution. Yet, you can still consider it.

 

Dave
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 26 Jun 2023, 05:30 PM

I tried your code and let the users give it a try.   They prefer the previous solution by just disabling the repositioning. 

Thanks for another solution, but it'll stand for now.  There are at least a thousand more things on the to-do list.  I'll revisit this once the work queue is at a manageable level.

Tags
Callout TextBox
Asked by
Dave
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or