diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-09-29 21:00:46 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-09-29 21:00:46 +0000 |
commit | 584330ee3c39fb2d21bee5cfa4a0bf28698436d3 (patch) | |
tree | 0e8ff396932d76e2fcf9af9a6c450da3bc005a87 | |
parent | 5fa65868c9d4c8276fbfa4483cb6e32091718bc3 (diff) | |
download | fpGUI-584330ee3c39fb2d21bee5cfa4a0bf28698436d3.tar.xz |
* A minor fix in ShowModal handling if an error occurs while showing - the user input could be blocked.
-rw-r--r-- | src/gui/fpg_form.pas | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas index f9740a36..b95f194a 100644 --- a/src/gui/fpg_form.pas +++ b/src/gui/fpg_form.pas @@ -263,26 +263,28 @@ begin fpgApplication.PushModalForm(self); ModalResult := mrNone; - Show; - - // processing messages until this form ends. - // delivering the remaining messages - fpgApplication.ProcessMessages; try - repeat - fpgWaitWindowMessage; - until (ModalResult <> mrNone) or (not Visible); - except - on E: Exception do - begin - ModalResult := -1; - Visible := False; - fpgApplication.HandleException(self); - end; - end; - - fpgApplication.PopModalForm; - Result := ModalResult; + Show; + // processing messages until this form ends. + // delivering the remaining messages + fpgApplication.ProcessMessages; + try + repeat + fpgWaitWindowMessage; + until (ModalResult <> mrNone) or (not Visible); + except + on E: Exception do + begin + ModalResult := -1; + Visible := False; + fpgApplication.HandleException(self); + end; + end; { try..except } + finally + { we have to pop the form even in an error occurs } + fpgApplication.PopModalForm; + Result := ModalResult; + end; { try..finally } if ModalResult <> mrNone then begin |