all groups > vb.net controls > november 2005 >
You're in the

vb.net controls

group:

Treeview Problems



Treeview Problems Mattbooty
11/16/2005 6:19:26 PM
vb.net controls: Ok, here is what I'm trying to accomplish. I have a treeview. Each
node has 2 parts, a title and the data (i.e. "Author: Joe Smith" or
"Editor: Jill Lane"). I need to let the user edit the "data" section
of the nodes but not the "title" section. So instead of going the
labelEdit route, I tried bringing up a textbox on MouseUp and doing the
editing there. Here is where it gets tricky. I can get the textbox to
go to the right spot, become visible get the data, all that easy stuff,
and I can get it to hide again and save the data back to the node with
textbox.Validated event. BUT I can't set focus on the textbox after
making it visible (the treeview bug of take focus back AFTER the
MouseUp event finishes). I found other topics discussing this, and the
work around i found on groups was to set focus in Treeview.Mouseup then
in textbox.GotFocus set focus again. The problem here is that with the
textbox getting then losing then getting focus again, the validated
event fires and hides the textbox again.

What can I do? Any solution would be appreciated, even if the solution
means doing something completely different, as long as the user can
edit the data without being able to touch the title. If there is
another way to accomplish seperating these sections apart in the
treeview that I am unaware of, or different events to use to set the
focus. Anything, I'm getting desperate.

Thanks,

Matt Booty
Re: Treeview Problems pwiecz NO[at]SPAM gmail.com
12/15/2005 6:33:43 AM
I suggest looking at elder solution from:
http://groups.google.pl/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/61f3eeb42cde717/77a0136c55ee298d?lnk=st&q=treeview+focus+problem&rnum=40&hl=pl&fwc=1

You just have to send Focus() message asynchronously.

Hope it helps.

Piotr Wieczorek
AddThis Social Bookmark Button