We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Treeviewadv node editing

Hi, I am using the treeviewadv version 4.1.0.50.
This version has a bug that is very annoying to the users. When the user click a label that is in edit mode, the label goes out of the edit mode. The expected behaviour would be that the cursor should be repositioned within the label text instead. Can you suggest any workaround for this problem? (I do not want to upgrade.)

Thanks,
Kjetil

3 Replies

MU Murugan Syncfusion Team February 9, 2007 09:01 PM UTC

Hi Kjetil,

My sincere apologizes for the inconvenience caused. We could see the issue as you mentioned. The issue has been fixed in our latest release. Herewith I have provided the workaround for the issue.

Here is the code snippet

private void treeViewAdv1_BeforeEdit(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs e)
{

e.TextBox.MouseDown -=new MouseEventHandler(TextBox_MouseDown);
e.TextBox.MouseDown +=new MouseEventHandler(TextBox_MouseDown);

}

private void TextBox_MouseDown(object sender, MouseEventArgs e)
{
this.treeViewAdv1.BeginEdit();

}

Please refer to the sample and let me know if it helps you.

LabelEditWorkaround

Thanks for using Syncfusion products.

Regards,
Murugan P.S


AD Administrator Syncfusion Team February 16, 2007 07:41 PM UTC

I tried your code and it indeed avoided the problem with the node going out of edit mode. However, selection with the mouse in the text box still didn't work quite as expected. Adding the below code to the TextBox_MouseDown handler seemed to solve this problem also. Thanks a lot for your support!


TextBox tb = sender as TextBox;
if (tb == null)
return;

int startIndex = tb.GetCharIndexFromPosition(e.Location);
if (startIndex == tb.Text.Length - 1 && tb.GetPositionFromCharIndex(startIndex).X < e.Location.X)
startIndex++;
tb.Select(startIndex, 0);


MU Murugan Syncfusion Team February 16, 2007 07:52 PM UTC

Hi Kjetil,

Thank you for your update and the code snippet posted.

Have a nice weekend!

Regards,
Murugan P.S

Loader.
Live Chat Icon For mobile
Up arrow icon