EDIT3: New problem:
Can't get a TPopupMenu to work at all... is there some difference in the coding between scar and simba?
Simba Code:
program new;
{$i SRL/SRL.simba}
var
Form1_1: TForm;
SessionTagPopup: TPopUpMenu;
ExerciseTags: array of TMenuItem;
SampleTags: TStringArray;
MenuButton: TButton;
Procedure MenuPopup(Sender: TObject);
var
x,y: Integer;
begin
GetMousePos(x,y);
SessionTagPopup.POPUP(x,y);
end;
Procedure InitForm;
var
i: Integer;
begin
SampleTags := ['Upper','Lower','Biceps','Triceps','Quads'];
with Form1_1 do
begin
Form1_1 := CreateForm;
Left := 325;
Top := 187;
Caption := 'Form1';
ClientHeight := 700;
ClientWidth := 700;
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'Tahoma';
Font.Style := [];
PixelsPerInch := 96;
Position := poScreenCenter;
end;
SetLength(ExerciseTags,Length(SampleTags));
SessionTagPopup := TPopupMenu.CREATE(Form1_1);
for i := 0 to High(SampleTags) do
begin
ExerciseTags[i] := TMenuItem.CREATE(Form1_1);
ExerciseTags[i].Caption := SampleTags[i];
SessionTagPopup.ITEMS.ADD(ExerciseTags[i]);
end;
MenuButton := TButton.Create(Form1_1);
with MenuButton do
begin
Parent := Form1_1;
Left := 220;
Top := 460;
Width := 90;
Height := 50;
Caption := 'MenuButton!';
OnClick := @MenuPopup;
end;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
Form1_1.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
Procedure ShowPlayerForm;
begin
SafeInitForm;
SafeShowFormModal;
end;
Begin
ShowPlayerForm;
End.