Listview rubberbanding issue
-
Hi all, It seems an application i'm working on has developed a problem. My colleague has created a user control which inherits the ListView control so we can implement an edit in place feature. The edit in place feature simply listens for an event when you click on a rows subitem and if its the cell you want to edit, it will move and resize a textbox over the cell and pull the value. An event (endediting) is fired when the control looses focus or a certain key is pressed. We use this event do what we want with the value typed in. This seems to work fine unless you stick in something that causes the listview to loose focus whilst within this event. I am attempting to parse the value typed in and if its invalid, I am throwing an error (messagebox) to notifiy the user and setting the cancel flag (e.Cancel.) If I use the mouse to click the OK button within the MessageBox, when it disappears an Rubberband appears on my cursor and remains inside the listview. The only way to remove this is to either click the mouse, alt+tab to cause the form to invalidate or press escape. If I use the enter or escape key to clear the MessageBox, the above doesn't happen and the listview regains focus. I'm now at a loss, I have no idea where to turn :(( I have tried invalidating the form, the listview etc, i've tried forcing the focus of all of the controls within the same form and i've even tried sending the escape key to the app using sendkeys. Has anyone got any idea's why? I'd appreciate your input! Regards
-
Hi all, It seems an application i'm working on has developed a problem. My colleague has created a user control which inherits the ListView control so we can implement an edit in place feature. The edit in place feature simply listens for an event when you click on a rows subitem and if its the cell you want to edit, it will move and resize a textbox over the cell and pull the value. An event (endediting) is fired when the control looses focus or a certain key is pressed. We use this event do what we want with the value typed in. This seems to work fine unless you stick in something that causes the listview to loose focus whilst within this event. I am attempting to parse the value typed in and if its invalid, I am throwing an error (messagebox) to notifiy the user and setting the cancel flag (e.Cancel.) If I use the mouse to click the OK button within the MessageBox, when it disappears an Rubberband appears on my cursor and remains inside the listview. The only way to remove this is to either click the mouse, alt+tab to cause the form to invalidate or press escape. If I use the enter or escape key to clear the MessageBox, the above doesn't happen and the listview regains focus. I'm now at a loss, I have no idea where to turn :(( I have tried invalidating the form, the listview etc, i've tried forcing the focus of all of the controls within the same form and i've even tried sending the escape key to the app using sendkeys. Has anyone got any idea's why? I'd appreciate your input! Regards
Well i've resolved it. By setting the following properties, it no longer causes the undesired effect. FullRowSelect = true; HeaderStyle = NonClickable; HideSelection = false; MultiSelect = false;