SRL Archive - OSR Help

OnItemClick


Dan Cardin

2010-07-28 09:29:24

var
frmMain: TForm;
UserList: TCheckListBox;

procedure Panel2Clic(Sender: TObject; Index: Integer);
begin

end;

procedure InitForm;
begin
frmMain := TForm.Create(nil);
frmMain.SetBounds({L} 100, {T} 100, {W} 600, {H} 400);

UserList := TCheckListBox.Create(frmmain);
UserList.Parent := frmmain;
UserList.SetBounds(24,40,225,241);
UserList.OnItemClick := @Panel2Clic;
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frmMain.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

begin
try
SafeInitForm;
SafeShowFormModal;
finally
frmMain.Free;
except
Writeln(ExceptionToString(ExceptionType, ExceptionParam));
end;
end.
Anyone know what's wrong with this?

Emaziz

2010-07-28 10:47:59

Arrays can't have a size of 0, can they? :blink:

Shuttleu

2010-07-28 11:03:49

it should be OnClick ;)

~shut

Naum

2010-07-28 13:49:35

From: Shuttleu
it should be OnClick ;)

~shut


.OnClick for SCAR only bro, I gather he's using Simba.
It works fine in SCAR with just Sender: TObj and .OnClick, if that's actually any consolation to you, which it probably is not.

The problem seems to be in this line:
UserList.OnItemClick := @Panel2Clic;  
If that helps in any way, I'm not sure about what .OnItemClick accepts, haven't use Simba in a while..

Hope that helps in some shape or form.

Dan Cardin

2010-07-28 16:21:15

Yea, for some reason Simba only has OnClickItem and OnClickCheck or something like that. I knew what line was the problem, and i had to look it up on the lazarus site to get the arguments. The script wont compile without the correct ones, and this one dies after compiling, so i assume that they're right.

Wizzup?

2010-07-30 13:20:13

What exactly is the problem? Could you quickly summarize the problem? I didn't get to fully understand the problem.

Dan Cardin

2010-08-20 15:44:00

Exception: Access violation
Error: Out Of Range at line 638

at UserList.OnItemClick := @Panel2Clic;

EDIT: Wizzup or MastaRaymond?