[Lazarus] How to make TCheckListBox read only

Alberto Narduzzi albertonarduzzi at yahoo.com
Thu Aug 4 22:16:24 CEST 2011


I saw that my reply posted from the web was not readable... :-(

So here it is again.


> A simple
>
> checklistbox1.enabled := false wouldnt do it.
>
> Try this code :
>
> procedure TForm1.CheckListBox1ItemClick(Sender: TObject; Index: integer);
> begin
> checklistbox1.Checked[index] := not checklistbox1.Checked[index] ;
> end;

that _of_course_ wouldn't work. It's not the user changing the 
checkboxes... it's your code!

if you disable the checklistbox, that will only keep the users from 
being able to change the status of the single checkboxes.
Moreover, why are you toggling the "checked" propery, in the onclick? It 
gets changes its state already...

Cheers, A.




More information about the Lazarus mailing list