spebola Posted March 14, 2003 Posted March 14, 2003 I have a listview & a treeview on a windows form. The listview has the focus. If a node is clicled in the treeview, the afterselect event for the treeview fires before the leave event for the listview. Is there any way to reverse this event sequence? The treeview was added to the form before the listview. Does this have any effect on the event's sequence? Any comments would be appreciated. Quote
spebola Posted March 15, 2003 Author Posted March 15, 2003 More info on the above question. After further testing the events seem to fire in the following order: TreeView Click Treeview BeforeSelect Treeview AfterSelect Listview Leave Treeview Enter I have duplicated this behavior with a textbox and treeview. The events fire in the above order when the other control has focus and a mouse click is used to select a node in the treeview. If the tab key is used to give the treeview focus, then the events fire in the correct order. Quote
bpayne111 Posted March 17, 2003 Posted March 17, 2003 sounds wierd... in wierd events situations like that i always try and add some sort of flag to let me know if i want to execute my code or not. Add a boolean field to your Class and see if you can make that help someway (until you find out the real issue of course) Quote i'm not lazy i'm just resting before i get tired.
spebola Posted March 18, 2003 Author Posted March 18, 2003 I received the following response from Microsoft on this issue: I have further researched your first issue regarding the order of the events being fired, and I have confirmed that this is actually by design. The TreeView control gets the click and selection changes events as a result of the mouse click before the focus actually changes to the TreeView control. Therefore you see the order of events as the following: TreeView1_Click TreeView1_BeforeSelect TreeView1_AfterSelect TextBox1_Leave TreeView1_Enter I hope this is helpful. Please let me know if you have any questions about it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.