Wizzup? and Ron:
I use Simba exclusively since discovering it, and [sometimes painstakingly] convert whatever information I find -- which is usually Scar related -- over to it. Would you prefer I perform a search first and post to an old thread, or just keep writing new threads?
Can't wait till the Simba docs are completed! (Examples would be nice, too.. *hint*)
What I was trying to do is create a window to write messages to.
Simba Code:
program ActivityLog;
const
CR = #$0D;
LF = #$0A;
CRLF = CR + LF;
var
ActivityLog: TForm;
LogMemo: TMemo;
btnCopy, btnClose: TButton;
procedure CopyMemoToClipboard(Sender: TObject);
begin
LogMemo.SELECTALL;
LogMemo.COPYTOCLIPBOARD;
end;
procedure ActivityLog_OnResize(Sender: TObject);
begin
with ActivityLog do
begin
//First set a minimum height and width:
if ClientWidth < 250 then ClientWidth := 250;
if ClientHeight < 60 then ClientHeight := 60;
//Then change the other controls:
LogMemo.Width := ClientWidth - 5;
LogMemo.Height := ClientHeight - 35;
btnCopy.Top := ClientHeight - 32;
btnClose.Top := ClientHeight - 32;
btnClose.Left := ClientWidth - 124;
end;
end;
procedure ActivityLog_Init;
begin
ActivityLog := TForm.Create(ActivityLog);
with ActivityLog do
begin
Width := 800;
Height := 120;
Top := 610;
Left := 60;
Caption := 'Activity Log:';
OnResize := @ActivityLog_OnResize;
end;
LogMemo := TMemo.Create(ActivityLog);
with LogMemo do
begin
Parent := ActivityLog;
Top := 2;
Left := 2;
Height := ActivityLog.Height - 30;
Width := ActivityLog.Width - 4;
Color := ClWhite;
Scrollbars := ssBoth;
FONT.Name := 'Lucida Console';
end;
btnCopy := TButton.Create(ActivityLog);
with btnCopy do
begin
Parent := ActivityLog;
Top := ActivityLog.Height- 27;
Left := 2;
Width := 120;
Height := 25;
Caption := 'Copy to Clipboard';
Hint := 'Copy the activity log to the Windows Clipboard.';
ShowHint := True;
OnClick := @CopyMemoToClipboard;
end;
btnClose := TButton.Create(ActivityLog);
with btnClose do
begin
Parent := ActivityLog;
Top := ActivityLog.Height - 27;
Left := ActivityLog.Width - 124;
Width := 120;
Height := 25;
Caption := 'Close';
Hint := 'Close this window.';
ShowHint := True;
Enabled := False;
end;
end;
procedure ActivityLog_SafeInit;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ActivityLog_Init', v);
end;
procedure ActivityLog_Show;
begin
ActivityLog.ShowModal;
end;
procedure ActivityLog_SafeShow;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ActivityLog_Show', v);
end;
procedure WriteLog(LogEntry: string);
var
h, m, s, ms: word;
begin
DecodeTime(Now(), h, m, s, ms);
LogMemo.Text := LogMemo.Text + format('[%d:%d:%d.%d] %s',
[h, m, s, ms, LogEntry]);
end;
procedure WriteLnLog(LogEntry: string);
var
h, m, s, ms: word;
begin
DecodeTime(Now(), h, m, s, ms);
LogMemo.Text := LogMemo.Text + format('[%d:%d:%d.%d] %s%s',
[h, m, s, ms, LogEntry, CRLF]);
end;
begin
ActivityLog_SafeInit;
WriteLnLog('Activity Log Started.');
ActivityLog_SafeShow;
end.
Do I get my answer regarding Show/ShowModal now?