[Progress Communities] [Progress OpenEdge ABL] Forum Post: DisposeDialogOnClose bug

  • Thread starter Thread starter Lieven De Foor
  • Start date Start date
Status
Not open for further replies.
L

Lieven De Foor

Guest
According to the OpenEdge documentation ( documentation.progress.com/.../index.html and StackOverflow/Microsoft ( stackoverflow.com/.../3097383 , a Form that is not shown modally, gets disposed on Close(). When the Form is shown modally (i.e. ShowDialog()), the Dispose does not happen automatically and you need to call Dispose() yourself. Progress thought it would be helpful to provide a way to by default have the Form dispose when it's closed as Dialog as well. While this seems reasonable, there is a bug in the implementation: In the Microsoft implementation, when closing a non-modal Form, the Dispose happens AFTER the form has closed (i.e. after OnFormClosed()) In the OpenEdge implementation of DisposeDialogOnClose, when closing a modal Form, the Dispose happens INSIDE the OnFormClosed() method of Progress.Windows.Form. This can be seen by looking at the stack trace when overridding OnFormClosed and subscibing the Disposed event of a Form and closing the screen. This causes code that uses the FormClosed event of the Form to no longer be able to access properties of the Form when started as dialog, while still being available when started non-modally! In my particular case I'm saving some screen settings in FormClosed, and this fails when the same Form is shown as dialog, since the form is already disposed... I'm trying a workaround now by setting DisposeDialogOnClose to false, and calling the Dispose() method myself at the very end of OnFormClosed(), but that will still cause problems for classes inheriting from my base form class...

Continue reading...
 
Status
Not open for further replies.
Back
Top