From 84b846870972bc8e8de0a1941097a8939b086c84 Mon Sep 17 00:00:00 2001 From: graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> Date: Thu, 19 Jun 2008 11:59:54 +0000 Subject: * Restore button state if an exception occurs inside the Click event. --- src/gui/gui_button.pas | 8 ++++++-- src/gui/gui_form.pas | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas index b1225d50..5d9f9eef 100644 --- a/src/gui/gui_button.pas +++ b/src/gui/gui_button.pas @@ -379,6 +379,7 @@ begin begin FDown := False; RePaint; + fpgApplication.ProcessMessages; if PtInRect(r, Point(x, y)) then Click; end; @@ -386,10 +387,13 @@ begin else begin if FDown and FClicked then + begin + FDown := False; + RePaint; + fpgApplication.ProcessMessages; if PtInRect(r, Point(x, y)) then Click; - FDown := False; - RePaint; + end; end; FClickOnPush := False; diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas index abcee416..843345d1 100644 --- a/src/gui/gui_form.pas +++ b/src/gui/gui_form.pas @@ -237,7 +237,7 @@ end; function TfpgForm.ShowModal: integer; var - CloseAction: TCloseAction; + lCloseAction: TCloseAction; begin FWindowType := wtModalForm; fpgApplication.PushModalForm(self); @@ -266,8 +266,8 @@ begin if ModalResult <> 0 then begin - CloseAction := caFree; // Dummy variable - we do nothing with it - DoOnClose(CloseAction); // Simply so the OnClose event fires. + lCloseAction := caFree; // Dummy variable - we do nothing with it + DoOnClose(lCloseAction); // Simply so the OnClose event fires. end; end; -- cgit v1.2.3-70-g09d2