Change button caption from time to time

This commit is contained in:
Ansgar Becker
2014-11-22 19:29:05 +00:00
parent 92d9769b64
commit 78d4cdbee3

View File

@@ -1016,6 +1016,8 @@ type
FGridPasting: Boolean;
FHasDonatedDatabaseCheck: TThreeStateBoolean;
FFocusedTables: TDBObjectList;
FCaptions: TStringList;
FLastCaptionChange: Cardinal;
// Host subtabs backend structures
FHostListResults: TDBQueryList;
@@ -1650,6 +1652,12 @@ begin
end;
FHasDonatedDatabaseCheck := nbUnset;
btnDonate.Visible := HasDonated(True) <> nbTrue;
FCaptions := Explode(',',
f_('Become a donor of the %s project', [AppName])+','+
_('Donate')+','+
_('Send a donation')+','+
f_('Donate to the %s project', [AppName])
);
actQueryStopOnErrors.Checked := AppSettings.ReadBool(asStopOnErrorsInBatchMode);
actBlobAsText.Checked := AppSettings.ReadBool(asDisplayBLOBsAsText);
@@ -11576,6 +11584,18 @@ begin
end;
procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean);
var
i: Integer;
begin
if FLastCaptionChange < GetTickCount-10000 then begin
Randomize;
i := RandomRange(0, FCaptions.Count);
btnDonate.Caption := FCaptions[i];
FLastCaptionChange := GetTickCount;
end;
end;
procedure TMainForm.ApplicationDeActivate(Sender: TObject);
begin
// Prevent completion window from showing up after Alt-Tab. See issue #2640