In place edit auto-highlighting

6 posts, 0 answers
  1. John Cornell
    John Cornell avatar
    11 posts
    Member since:
    Feb 2007

    Posted 04 Jun 2007 Link to this post

    Hi,

    I have just begun to test swapping out the Windows default tree view with the Rad one, and I am quite impressed, however, I am lacking one piece of functionality which is very important.

    On the Windows tree view, when a begin edit is performed, either by in place clck or programatically, the text is automatically highlighted and the focus is placed in the label.

    The rad BeginEdit (bool focus) does not even focus the label, so the label needs to be clicked before a user can type.

    Is it possible, programatically, or automatically to have all the text on a label highlighted when a Begin Edit is performed?

    Thanks
  2. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 04 Jun 2007 Link to this post

    Hello John,

    Unfortunately there is no way currently to highlight the text in the editor on Begin Edit. That will be corrected in the Q2 release for which we are planning big improvements in the editor API.
     

    Regards,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. John Cornell
    John Cornell avatar
    11 posts
    Member since:
    Feb 2007

    Posted 04 Jun 2007 Link to this post

    Thanks,

    When is that release due?
  5. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 04 Jun 2007 Link to this post

    Hi John Cornell,
    We are planning for September, but probably we will come out with BETA sooner.

    Regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. John Cornell
    John Cornell avatar
    11 posts
    Member since:
    Feb 2007

    Posted 05 Jun 2007 Link to this post

    There doesn't appear to be a TreeControl KB area for me to submit this work around to.

    The following code allows for code highlighting and focus on begin edit, and allows the ENTER key to end edit. I appreciate that this may be fixed in Q2 fix, however this is working for me now, otherwise I would have had to swap the control for a default windows one

     
            //CALL THIS WHEN BeginEdit IS REQUIRED  
             private void AllowSelectedNodeEdit()  
            {  
                if (radTree.SelectedNode != null && radTree.SelectedNode != radTree.Nodes[0])  
                {  
                    radTree.LabelEdit = true;  
     
                    //BEGIN THE EDIT BEFORE MANIPULATING THE CONTROL  
                    radTree.SelectedNode.BeginEdit(true);  
     
                    foreach (Control ctl in radTree.Controls)  
                    {  
                        //LOCATE THE RADTEXTBOX  
                        if (ctl is RadTextBox)  
                        {  
                            //IF REQUIRED, SET MODIFIED TEXT HERE  
                            ((RadTextBox)ctl).Text = radTree.SelectedNode.Text.Substring  
                                (0, radTree.SelectedNode.Text.Length - helper.GetTextSuffix(radTree.SelectedNode.Tag.ToString()).Length);  
     
                            //ADD A KEYDOWN EVENT HANDLER TO CAPTURE THE ENTER KEY  
                            ((RadTextBox)ctl).KeyDown += new KeyEventHandler(txt_KeyDown);  
     
                            //SET FOCUS  - THIS WILL AUTOMATICALLY SELECT ALL TEXT  
                            ((RadTextBox)ctl).Focus();  
                        }  
                    }  
                }  
            }  
     
     
     
            void txt_KeyDown(object sender, KeyEventArgs e)  
            {  
                //TRAP THE ENTER KEY - HIDE THE CONTROL TO FIRE THE AFTERLABELEDIT EVENT  
                if (e.KeyCode == Keys.Enter)  
                {  
                    if (radTree.IsEditing)  
                    {  
                        if (radTree.SelectedNode != null)  
                        {  
                            ((RadTextBox)sender).Hide();  
                        }  
                    }  
                }  
            } 
  7. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 11 Jun 2007 Link to this post

    Hi John,

    Our KB is not open for editing by the public yet, but I have created a RadTreeView section in our Code Library:
    http://www.telerik.com/community/code-library/default.aspx. We have plans to merge the KB with the Code Library to give our clients the ability to edit/add new articles on demand.

    Feel free to post your solution using the link above. Once you do so, we will review it and will post it on our site.

    Thank you for your involvement in the Telerik community. Your efforts will be rewarded.


    Sincerely yours,
    Jordan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for WinForms is Visual Studio 2017 Ready