本文整理自网络,侵删。
功能
1、Listbox Accessory图标变换
2、Listitem Detail如果为空,则补选中
3、aCheckmark切换
Delphi/Pascal
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;
相关阅读 >>
Delphi 使用tnethttprequest / tnethttpclient访问web服务器
Delphi idhttp中设置非标准头信息和读写cookie
更多相关阅读请进入《Delphi》频道 >>