Set focus to textbox in editable tab header

9 posts, 0 answers
  1. Roman
    Roman avatar
    6 posts
    Member since:
    Aug 2010

    Posted 10 Aug 2010 Link to this post

    Hi,

    I've looked over the thread regarding making the tab header's editable. I've got that working, so far, and that's great. I would now like to add functionality to this so that when a context menu is opened from right clicking on the tab header, the user can click on the "Rename" item from the context menu and the textbox in the header will receive focus and have it's contents selected so the user can simply type in the new name of the tab header and click on the Enter key to save the changes and show the label with the new changes. I've tried setting with control.focus and control.selectall methods, but I cannot get focus to that textbox.

    Any ideas on how to implement something like that?

    Thanks
    Roman
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 13 Aug 2010 Link to this post

    Hi Roman,

    You can try first to make sure that the Silverlight plug-in has the focus:
    System.Windows.Browser.HtmlPage.Plugin.Focus();

    And after that focus the textBox, but invoked in the dispatcher thread.
    Dispatcher.BeginInvoke(() => { textText.Focus();});

    Can you give it a try and let us know if it works for you.

    Kind regards,
    Miro Miroslavov
    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. DevCraft banner
  4. Roman
    Roman avatar
    6 posts
    Member since:
    Aug 2010

    Posted 13 Aug 2010 Link to this post

    Hi Miro,

    Thanks for your reply. However, I do not know where I should be incorporating the code you showed me into the editable tab header example shown here:

    http://www.telerik.com/help/silverlight/radtabcontrol-how-to-make-the-tab-headers-editable.html

    This is the example I would like to add functionality to have a "Rename" option in a right click menu on the header to setfocus to and selectall the text in the textbox.

    Also, if you could show me examples in VB, that would be great since that's what I'm using.

    Thanks,
    Roman
  5. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 17 Aug 2010 Link to this post

    Hi Roman,

    You should use this two lines instead of the "control.Focus()" that you said previously you've tried. (I've tried setting with control.focus and control.selectall methods, but I cannot get focus to that textbox.).
    Hope will work for you.

    Sincerely yours,
    Miro Miroslavov
    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
  6. Roman
    Roman avatar
    6 posts
    Member since:
    Aug 2010

    Posted 18 Aug 2010 Link to this post

    Hi Miro,

    Yes, this did work for me. Thank you so much for your help.

    Sincerely,
    Roman
  7. Pranama Moorthy
    Pranama Moorthy avatar
    26 posts
    Member since:
    Jun 2010

    Posted 09 Dec 2010 Link to this post

    Hi,

    I have an editable RadtabControl, and below is the feature that I want.

    When I actually click on the editable Control (textbox), to rename the RadTab, then that tab should be selected. By The example that is given, when I actually try to edit a text for the header, the radTab Containing the Text is not highlighted (not selected).

    In Short, I want the selected item to be that RadTabITem on which I am actually making a header change. Is there  a way to let the RadTabItem know that its header is being changed, so it needs to be selected?




  8. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Dec 2010 Link to this post

    Hi Pranama Moorthy,

    Do you enter in the EditMode with mouse double click?  If so, on the first click of the mouse, the RadTabItem`s Header gets selected and the second click makes the Header be in EditMode. You can inspect that in the attached solution. Please also note that in one moment, you can have several TabItems that are in EditMode, which is expected behavior. If this is not what you had in mind, please elaborate more on how you enter the edit mode and do you want a single editable tab header at a moment. Thank you in advance for your cooperation.

    Regards,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  9. Pranama Moorthy
    Pranama Moorthy avatar
    26 posts
    Member since:
    Jun 2010

    Posted 12 Jan 2011 Link to this post

    Hi Petar,

     Apologizes for a late response. My Requirements are something as below

    1. Only when the tab is selected (Active), should it allow editing. (Other tabs which are not active, should not be editable).
    2. The user should then be able to edit only the active tab, by double clicking it.

    Hope this is feasible.

    Regards,
    Pranama
  10. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 17 Jan 2011 Link to this post

    Hi Roman,

    I made a workaround for you that uses the PreviewSelctionChanged event of the TabControl. Basically, I turn off the Edit mode of  the RadTabItems. Hope this will fit in your scenario. Thank you in reporting this bug in the example from the article. I logged this in our internal system and updated your telerik points accordingly.

    All the best,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner