|
-
Jun 25th, 2007, 01:15 PM
#1
Thread Starter
Fanatic Member
[02/03] Textbox/Treeview fight for Focus()
I am trying to emulate the way Windows Explorer allows you to rename files by clicking on them, but in a Treeview. So, I am putting a panel on the treeview, and when they click correctly, I place it in the correct place.
However, I am trying to get the focus placed on the Textbox so I can SelectAll of the text. But, it isn't working because (as I found from debug statements) after the textbox grabs the focus, the treeview grabs it back. I can then click on it and everything works fine, but the focus not staying on the textbox is causing problems, and it just doesn't behave like Windows Explorer does.
Here is the code, am I missing anything fundamental?
Me.Panel1.Visible = True
Me.Panel1.BringToFront()
Me.TextBox1.Focus()
Me.TextBox1.SelectAll()
This is the tail end of the Mouse_Up Event of the Treeview. Like I said, everything works except that the treeview grabs focus after the Mouse_Up Event terminates, and I can't figure out why. Nothing else should be happening. Anybody know what I am doing wrong?
Thanks
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Jun 25th, 2007, 01:20 PM
#2
Thread Starter
Fanatic Member
Re: [02/03] Textbox/Treeview fight for Focus()
Little update. If I right-click on the selected node, it works like I want it to. Also, if I left-click on the selected node and move the mouse while holding the button it works. From looking at the debug statements, the treeview isn't grabbing the Focus if I do those two things. Anybody know what is going on?
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Jun 25th, 2007, 04:11 PM
#3
Thread Starter
Fanatic Member
Re: [02/03] Textbox/Treeview fight for Focus()
I have since fixed the problem. I would explain, but I'm not sure what it was that I did to fix it... it was really a combination of things. I'm not too pleased with the result, but maybe I will be once I get used to it. I just hope I don't run into serious problems with my implementation. I suppose I will leave the thread open, though, since maybe someone out there could explain what is going on.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|