2020-04-04 21:44:15 +00:00
|
|
|
unit Utils;
|
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2020-05-10 23:10:20 +00:00
|
|
|
Classes, SysUtils, StdCtrls, Dialogs;
|
2020-04-04 21:44:15 +00:00
|
|
|
|
|
|
|
function AnySelected(AListbox: TListBox): Boolean;
|
|
|
|
|
2020-05-10 23:10:20 +00:00
|
|
|
procedure ErrorMsg(const AMsg: String);
|
2020-05-11 16:21:39 +00:00
|
|
|
procedure ErrorMsg(const AMsg: String; const AParams: array of const);
|
2020-05-10 23:10:20 +00:00
|
|
|
|
2020-04-09 09:05:26 +00:00
|
|
|
procedure Exchange(var a, b: Double); overload;
|
|
|
|
procedure Exchange(var a, b: Integer); overload;
|
|
|
|
procedure Exchange(var a, b: String); overload;
|
|
|
|
|
2020-04-04 21:44:15 +00:00
|
|
|
implementation
|
|
|
|
|
|
|
|
function AnySelected(AListBox: TListBox): Boolean;
|
|
|
|
var
|
|
|
|
i: Integer;
|
|
|
|
begin
|
|
|
|
Result := false;
|
|
|
|
for i := 0 to AListbox.Items.Count-1 do
|
|
|
|
if AListbox.Selected[i] then
|
|
|
|
begin
|
|
|
|
Result := true;
|
|
|
|
exit;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2020-05-10 23:10:20 +00:00
|
|
|
procedure ErrorMsg(const AMsg: String);
|
|
|
|
begin
|
|
|
|
MessageDlg(AMsg, mtError, [mbOK], 0);
|
|
|
|
end;
|
|
|
|
|
2020-05-11 16:21:39 +00:00
|
|
|
procedure ErrorMsg(const AMsg: String; const AParams: array of const);
|
|
|
|
begin
|
|
|
|
ErrorMsg(Format(AMsg, AParams));
|
|
|
|
end;
|
|
|
|
|
2020-04-09 09:05:26 +00:00
|
|
|
procedure Exchange(var a, b: Double);
|
|
|
|
var
|
|
|
|
tmp: Double;
|
|
|
|
begin
|
|
|
|
tmp := a;
|
|
|
|
a := b;
|
|
|
|
b := tmp;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure Exchange(var a, b: Integer);
|
|
|
|
var
|
|
|
|
tmp: Integer;
|
|
|
|
begin
|
|
|
|
tmp := a;
|
|
|
|
a := b;
|
|
|
|
b := tmp;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure Exchange(var a, b: String);
|
|
|
|
var
|
|
|
|
tmp: String;
|
|
|
|
begin
|
|
|
|
tmp := a;
|
|
|
|
a := b;
|
|
|
|
b := tmp;
|
|
|
|
end;
|
|
|
|
|
2020-04-04 21:44:15 +00:00
|
|
|
end.
|
|
|
|
|