When you want to set focus to another control in the AfterSelect method of a treeview there seems to be a problem with the behavior. Focus is set to the control but is then returned to the Treeview.
Forcing the Focus asynchronously seems to solve this little issue.
How?
Add a delegate:
private delegate bool _methodInvoker();
Now in the AfterSelect handler add the following code:
myControl.BeginInvoke(new _methodInvoker(myControl.Focus));
Kept me busy quite some time :-(
Subscribe to:
Post Comments (Atom)
5 comments:
Set the HideSelection property to false. Voila.
Actually, I'm talking crap. That doesn't work - you can however handle the mouse up event and do a hit test to see if a node was selected.
Enable a timer control from your after select event and set the focus/disable the timer in the click event.
wow, wish i found this article sooner
thanks !
Thanks, it works nicely. The problems seems to affect other TreeView events too.
Post a Comment