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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Treeviewadv node editing

Thread ID:

Created:

Updated:

Platform:

Replies:

56111 Feb 9,2007 01:00 PM UTC Feb 16,2007 07:52 PM UTC Windows Forms 3
loading
Tags: Tools
Kjetil Kåresen
Asked On February 9, 2007 01:00 PM UTC

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

Murugan [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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);

Murugan [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;