问题描述
我在窗体中创建了一个TListView,将 ItemAppearance 更改为 DynamicAppearance .在结构上,我继续执行ListView1> ItemAppearance> Item> Add New ...>,然后选择了TTextButtonObjectAppearance.
I created a TListView in my Form, changed the ItemAppearance to DynamicAppearance. On the structure I went on ListView1> ItemAppearance> Item> Add New ...> and I picked the TTextButtonObjectAppearance.
好吧,现在我想知道如何在此按钮中设置OnClick事件,因为当我双击代码选项卡"时不会打开,并且对象检查器中的事件"选项卡没有选择.
Ok, now I want to know how can I set the OnClick event in this button, because when I double click the 'Code Tab' doesn't open, and the Event Tab in Object Inspector has nothing to choose.
推荐答案
将按钮的AppearenceObjectName设置为删除"和编辑".
Set the AppearenceObjectName of the buttons to Delete and Edit.
procedure TForm2.ListView1ButtonClick(const Sender: TObject;
const AItem: TListItem; const AObject: TListItemSimpleControl);
begin
if AObject.name = 'Delete' then
showmessage('Delete')
else if AObject.Name = 'Edit' then
showmessage('Edit');
end;
这篇关于使用TListView中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!