57,6 → 57,7 |
private |
PleaseStop: boolean; |
procedure ResetGui; |
procedure WaitMs(milliseconds: integer); |
end; |
|
var |
74,6 → 75,18 |
|
{ TForm2 } |
|
procedure TForm2.WaitMs(milliseconds: integer); |
var |
i: integer; |
begin |
for i := 0 to milliseconds div 10 do |
begin |
Sleep(10); |
Application.ProcessMessages; |
if PleaseStop or Application.Terminated then break; |
end; |
end; |
|
procedure TForm2.BtnStartClick(Sender: TObject); |
var |
x: THT46F47; |
89,12 → 102,18 |
BtnRandom.Enabled := false; |
|
x := THT46F47.Create; |
try |
x.OnWait := WaitMs; |
|
s := ''; |
ci := 0; |
for i := 1 to Length(Memo2.Text) do |
begin |
{$IFDEF UNICODE} |
if CharInSet(Memo2.Text[i], ['a'..'f', 'A'..'F', '0'..'9']) then |
{$ELSE} |
if Memo2.Text[i] in ['a'..'f', 'A'..'F', '0'..'9'] then |
{$ENDIF} |
begin |
s := s + Memo2.Text[i]; |
end; |
150,11 → 169,13 |
BtnRandom.Enabled := true; |
BtnStart.Enabled := true; |
ResetGui; |
finally |
FreeAndNil(x); |
end; |
end; |
|
procedure TForm2.BtnStopClick(Sender: TObject); |
begin |
// TODO: actually we need to inform the THT46F47 object, so it can break out of a possible waiting loop |
BtnStop.Enabled := false; |
PleaseStop := true; |
end; |