91
LCL / Re: Flickering issue when moving CheckboxList item
« Last post by KodeZwerg on March 31, 2023, 01:30:07 pm »No flicker here either (Win 11, Laz/main (32bit) FPC 3.2.2).You forgot about the issue that he got so I've upgraded a little.
Alternatively you could try a TListview with activated checkboxes (ListView1.Checkboxes := true); query the checked states from the corresponding TListItem property.
See attached demo (tested to work on Win, Linux/gtk2. It does not work on cocoa but there the customdrawn Checklistbox does not work either).
Set property DragMode for ListView1 to dmAutomatic
create OnDragDrop event with something like this:
- procedure TForm1.ListView1DragDrop(Sender , Source: TObject; X , Y: Integer);
- var
- MyItem : TListItem;
- begin
- if Source = ListView1 then
- with Source as TListView do
- begin
- if (GetItemAt(X,Y) <> nil) then
- begin
- MyItem := Items.Insert(GetItemAt(X,Y).Index);
- MyItem.Assign(Selected);
- Selected.Delete;
- end;
- end;
- end;
- procedure TForm1.ListView1DragOver(Sender , Source: TObject; X , Y: Integer;
- State: TDragState; var Accept: Boolean);
- begin
- If Source = ListView1 then
- Accept := True
- else
- Accept := False;
- end;
But I am unsure about how to display the content while you are dragging...