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

In place edit auto-highlighting

5 Answers 161 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
John Cornell
Top achievements
Rank 1
John Cornell asked on 04 Jun 2007, 12:27 PM
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

5 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 04 Jun 2007, 01:02 PM
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
0
John Cornell
Top achievements
Rank 1
answered on 04 Jun 2007, 01:33 PM
Thanks,

When is that release due?
0
Dimitar Kapitanov
Telerik team
answered on 04 Jun 2007, 03:07 PM
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
0
John Cornell
Top achievements
Rank 1
answered on 05 Jun 2007, 05:12 AM
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();  
                    }  
                }  
            }  
        } 
0
Jordan
Telerik team
answered on 11 Jun 2007, 10:24 AM
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
Tags
Treeview
Asked by
John Cornell
Top achievements
Rank 1
Answers by
Jordan
Telerik team
John Cornell
Top achievements
Rank 1
Dimitar Kapitanov
Telerik team
Share this question
or