Hello Pedrocelli,
P> Define a boolean form variable (FCheckBoxBusy or whatever), set it to false in
P> the FormCreate. At the start of the "previous code" mentioned, set the boolean
P> to true and back to false at the end. In the OnClick event, check the boolean
P> and if true just exit - so the code causing the loop is not executed.
P> Or something along those lines, depending on how the dependencies in your code
P> work.
No, that was the obvious easy way, which does not work.
What it needs is a check on where the cursor left position is in the control,
and if over the checkbox itself disregard the change of state.
The following gives an example of how to use it with RXcontrols - equally
applicable to standard checklistbox.
PROCEDURE TO ENABLE/DISABLE CHECKBOX BY USER CLICKING ON ITEMS:
procedure TMainform.RxCheckListBoxClick(Sender: TObject);
var pt: Tpoint;
begin
//avoid sender errors
if not (sender is TRXCheckListBox) then exit;
with sender as TRXCheckListBox do
begin
// get cursor position, convert to client coordinates
GetCursorPos(pt);
pt := ScreenToClient(pt);
// Cursor X>20 must be in items area, not over checkbox
if pt.x > 20 then Checked[ItemIndex] := not Checked[ItemIndex];
end;
end;
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/