diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-17 16:52:06 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-17 16:52:06 +0200 |
commit | 15fa09a3e30b9c8259d6d017647807e6c0699ddf (patch) | |
tree | e4880a80d18e6ba464c0b44fd884b3e17a931a9d /src | |
parent | 6b722c1da231087c637f566a140ce3f49de2ae3f (diff) | |
download | fpGUI-15fa09a3e30b9c8259d6d017647807e6c0699ddf.tar.xz |
hint window timer field variable renamed.
- Renamed the timer field variable from T_Chrono to FTimer.
- Renamed the OnTimer event handler from T_ChronoFini to HintTimerFired
- Disabled the timer *before* hinding the hint window. This prevents
those add AV's that occur when you close an application.
- No need to explicityl disable the timer in HintWindow destructor.
When you free a timer, it automatically gets disabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_hint.pas | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gui/fpg_hint.pas b/src/gui/fpg_hint.pas index 38fff686..9e8dfa3b 100644 --- a/src/gui/fpg_hint.pas +++ b/src/gui/fpg_hint.pas @@ -38,14 +38,14 @@ type FShadow: Integer; FBorder: Integer; FMargin: Integer; - T_Chrono: TfpgTimer; + FTimer: TfpgTimer; FHintTextRec: TfpgRect; FText: TfpgString; procedure FormShow(Sender: TObject); procedure FormHide(Sender: TObject); function GetText: TfpgString; procedure SetText(const AValue: TfpgString); - procedure T_ChronoFini(Sender: TObject); + procedure HintTimerFired(Sender: TObject); procedure SetShadow(AValue: Integer); procedure SetBorder(AValue: Integer); procedure SetTime(AValue: Integer); @@ -109,12 +109,11 @@ var procedure TfpgHintWindow.FormShow(Sender: TObject); begin - T_Chrono.Enabled:= True; + FTimer.Enabled:= True; end; procedure TfpgHintWindow.FormHide(Sender: TObject); begin - T_Chrono.Enabled := False; if Assigned(uShadowForm) then uShadowForm.Hide; end; @@ -129,11 +128,12 @@ begin FText := AValue; end; -procedure TfpgHintWindow.T_ChronoFini(Sender: TObject); +procedure TfpgHintWindow.HintTimerFired(Sender: TObject); begin {$IFDEF DEBUG} - writeln('DEBUG: TfpgHintWindow.T_ChronoFini timer fired'); + DebugLn('DEBUG: TfpgHintWindow.HintTimerFired timer fired'); {$ENDIF} + FTimer.Enabled := False; Hide; end; @@ -154,7 +154,7 @@ begin if FTime <> AValue then begin FTime := AValue; - T_Chrono.Interval := FTime; + FTimer.Interval := FTime; end; end; @@ -232,18 +232,17 @@ begin FShadow := 0; // no shadow by default FTime := 5000; // show hint for 5 seconds then close FHintTextRec.SetRect(FBorder, FBorder, Width-(FBorder*2), Height-(FBorder*2)); - T_Chrono := TfpgTimer.Create(FTime); - T_Chrono.OnTimer := @T_ChronoFini; + FTimer := TfpgTimer.Create(FTime); + FTimer.OnTimer := @HintTimerFired; uShadowForm:= TfpgHintShadow.Create(nil); - OnClick := @T_ChronoFini; + OnClick := @HintTimerFired; OnShow := @FormShow; OnHide := @FormHide; end; destructor TfpgHintWindow.Destroy; begin - T_Chrono.Enabled := False; - T_Chrono.Free; + FTimer.Free; FFont.Free; inherited Destroy; uShadowForm.Free; |