Delphi Listbox Accessory图标变换
Delphi Firemonkey中ListboxAccessory图标切换
功能
- 1、Listbox Accessory图标变换
- 2、Listitem Detail如果为空,则补选中
- 3、aCheckmark切换
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
procedure TForm1.ListBox1ItemClick(const Sender: TCustomListBox; const Item: TListBoxItem); var i: Integer; begin for i := 0 to ListBox1.Count - 1 do begin if (ListBox1.Selected.ItemData.Detail = '') or (ListBox1.ItemIndex < 2) or (ListBox1.ListItems[i] <> ListBox1.Selected) then ListBox1.ListItems[i].ItemData.Accessory := TListBoxItemData.TAccessory.aNone else ListBox1.ListItems[i].ItemData.Accessory := TListBoxItemData.TAccessory.aCheckmark; end; if (ListBox1.ItemIndex < 2) or (ListBox1.Selected.ItemData.Detail = '') then begin ListBoxItem5.IsSelected := true; ListBoxItem5.ItemData.Accessory := TListBoxItemData.TAccessory.aCheckmark; end; end; |