G
Guest
Hi,
I have created a user control which is basically an extension of a list box.
The listbox allows to edit the items by showing a control (e.g a text box,
but not necessarily) when an item is double clicked.
Due to requirement for generic implementation, the editing control is
acquired from an IListEditor interface for each edit operation, and added to
the control collection:
Control editControl = listEditor.BeginEdit(item);
Controls.Add(editorContol);
editControl.KeyPress += editorControlKeyPressHandler;
editControl.Bounds = rect;
When the edit operation ends, the control is removed from the collection:
Control editorContol = Controls[0];
editorContol.KeyPress -= editorControlKeyPressHandler;
Controls.Remove(editorContol);
Now, it all works fine when there is a single instance of the listbox on the
form. When there are two, the application does not close when i start
editing in the first list, then move to start editing in the second. If I
return to edit in the first, it will close.
Some additional info:
1. I have not used any static state.
2. The forms closing event is called.
3. The form closed event does not (when the problem occurs)
4. BeginEdit and EndEdit are called as expected and in the right sequence.
Any ideas?
TIA
Dani
I have created a user control which is basically an extension of a list box.
The listbox allows to edit the items by showing a control (e.g a text box,
but not necessarily) when an item is double clicked.
Due to requirement for generic implementation, the editing control is
acquired from an IListEditor interface for each edit operation, and added to
the control collection:
Control editControl = listEditor.BeginEdit(item);
Controls.Add(editorContol);
editControl.KeyPress += editorControlKeyPressHandler;
editControl.Bounds = rect;
When the edit operation ends, the control is removed from the collection:
Control editorContol = Controls[0];
editorContol.KeyPress -= editorControlKeyPressHandler;
Controls.Remove(editorContol);
Now, it all works fine when there is a single instance of the listbox on the
form. When there are two, the application does not close when i start
editing in the first list, then move to start editing in the second. If I
return to edit in the first, it will close.
Some additional info:
1. I have not used any static state.
2. The forms closing event is called.
3. The form closed event does not (when the problem occurs)
4. BeginEdit and EndEdit are called as expected and in the right sequence.
Any ideas?
TIA
Dani