[SOLVED] TreeView Node editing error

Answered Closed
0
0

Hi guys,

I have the following handler for the TreeView_KeyDown event, which used to work nicely before updating to version 1.2.67 (for completeness, also the Before/AfterLabelEdit events):

private void tv_KeyDown(object sender, KeyEventArgs e)
{
var node = tv.SelectedNode;

if (node != null)
{
switch (e.KeyCode)
{
case Keys.Delete:
Delete(node);
break;
case Keys.Insert:
Add(node);
break;
case Keys.F2:
Edit(node);
break;
}
}

}

private void Edit(TreeNode node)
{
tv.SelectedNode = node;
node.BeginEdit();
}

private void tv_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
{
string error = String.Empty;
short nodeId = Convert.ToInt16(e.Node.Tag);

MySession.Current.BLL.UpdateReferringType(nodeId, e.Label, e.Node.Checked, out error);
if (!String.IsNullOrEmpty(error))
{
MessageBox.Show(String.Format(“Error in editing TreeNode ‘{0}'”, error));
}
tv.KeyDown += tv_KeyDown;
}
private void tv_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e)
{
tv.KeyDown -= tv_KeyDown;
}

When I press now F2, I get into editing mode for the selected node Label, but when I press either Enter to accept or Esc to discard changes I get the attached Application Error, the changes are not accepted (or discarded) and, after the Error, the KeyDown event does not fire anymore, possibly because it is detached by the BeforeLabelEdit and is not re-attached by the AfterLabelEdit which does not fire (because of the error).

Any ideas?

Best,
Alex

 

  • You must to post comments
Best Answer
0
0

Thanks, Luca, that will be great. My application relies on such a calendar, so I’ll be glad to help with it, either with debugging or any other way you see appropriate.

Best,
Alex

  • You must to post comments
0
0

Not ready, but I will see if it’s usable enough to upload it or send it to you directly early next week.

/Luca

  • You must to post comments
0
0

Hi Luca,

Is your fullcalendar early version ready to be shared? I’d love to give it a try!

Best,
Alex

 

  • You must to post comments
0
0

ok, Luca, thanks, I suspected they were in spam, that’s why I had to notify you here.

But in fact, I am talking about the ShowNodeToolTips subject, not the Theme, for the theme you have answered saying that you’d rather use mixins for minor modifications.

Can you send me a mail with the complaints of Google about my yahoo mail? To check if I can fix something to stop having ,y emails going to your spam folder?

Best,

Alex

  • You must to post comments
0
0

Both emails were in spam again. I keep clicking “Not Spam” but Google complains about some kind of setting in yahoo…

Anyway, I had seen the message from Frank’s reply. We’ll make sure that the theme in /Themes can override the built-in same-name theme.

The fullcalendar will probably not be published until after the release but I can share an early version of the extension with source code.

Best,

Luca

 

  • You must to post comments
0
0

This is good news! And what about the fullcalendar? 🙂

Luca, just to make sure that we have some “Spam folder” loss of communication again… I have sent Frank and you a mail about the ShowNodeToolTips problem which I have seen and you couldn’t reproduce, with a test project which reproduces it. And also another mail asking you whether you have seen it, but I haven’t got a reply — so unusual of you. That’s why I’m asking.

Alex

  • You must to post comments
0
0

TreeView only handles F2 and the double0-delayed click.

Very close. Putting a lot of effort in closing all the minor issues which are usually the most annoying ones that creep in many controls. And one fix fixes the issue in many places.

The ListView is 80% and the PropertyGrid is undergoing but it’s based on the DataGridView. So the only new control is the item view in the list view which is based on the virtual framework in qooxdoo and it’s probably the one that will have more issues because of the short time left. However, the listview is way simpler than the datagridview.

 

  • You must to post comments
0
0

Ah, all those optimizations! 😛

Thanks. I had tried with double-click but hadn’t seen the node Label going into editing mode. May be the delay was not long enough and the double click took over.

If you say that I can edit with a second click with a short delay without needing to press F2, the original attachment is at least needed to bind the Insert and Delete keys. Unless they are also “pre-bound” like F2.

The reason I detached the KeyDown event handler was that I noticed that as I was typing my normal text (to edit the label) the keyDown was firing (correctly) for every typed letter, and I thought that this would be delaying the whole process, with a round trip to the server for each letter. So, I decided to detach it in BeforeLabelEdit, and then re-attach it in AfterLabelEdit.

Thanks Luca. How close do you think you are to your release now?

Best,
Alex

  • You must to post comments
0
0

Got it. It’s a regression caused by an optimization 🙂

Now wisej is able to automatically translate widget ids from the client into widget references when receiving events. But nobody told the TreeView which tried to resolve the string id into a component when it was already a component.

BTW, you don’t need to attach/detach the key handler and handle F2. When the property LabelEdit is true, the TreeView already handles F2 to start editing. You can also start editing when clicking a second time on the same node, after a delay.

Best,

Luca

  • You must to post comments
Showing 9 results