如何以编程方式进入一个TListView的项目的编辑模式? [英] How to programmatically enter edit mode of an item in a TListView?
问题描述
在的TListView
控件,您可以通过点击两次编辑项目。项目周围就会出现一个框,用户在输入一个新值。我如何编程启用编辑模式?我想,以防止意外编辑列表,并禁用编辑(通过启用只读
属性)。然后,当用户presses一个修改
按钮,该项目将成为活跃的编辑。我怎样才能做到这一点?
In the TListView
control, you can edit an item by clicking on it twice. A box appears around the item for user to type in a new value. How can I enable edit mode programmatically? I would like to protect the list from accidental editing, and disable editing (by enabling the ReadOnly
property). Then, when the user presses an Edit
button, the item will become active to edit. How can I do this?
另外,如果假设用户选择一个项目,然后滚动出该项目的看法,那么presses 修改
,列表首先需要滚动使该项目可见。
Also, if suppose the user selects an item, then scrolls out of that item's view, then presses Edit
, the list needs to first scroll to make that item visible.
推荐答案
设置完成后只读
为false,你可以调用<一个href=\"http://docwiki.embarcadero.com/Libraries/en/Vcl.ComCtrls.TListItem.EditCaption\"><$c$c>EditCaption$c$c>方法。呼叫<一个href=\"http://docwiki.embarcadero.com/Libraries/en/Vcl.ComCtrls.TListItem.MakeVisible\"><$c$c>MakeVisible$c$c>滚动视图中的项目。
After setting ReadOnly
to false you can call the EditCaption
method. Call MakeVisible
to scroll the item in view.
ListView1.Items[0].MakeVisible(False);
ListView1.items[0].EditCaption;
这篇关于如何以编程方式进入一个TListView的项目的编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!