首页 > 其他 > 详细

listview findCaption

时间:2019-06-27 09:02:02      阅读:174      评论:0      收藏:0      [点我收藏+]

procedure TfrmCaoZYGLNew.edt1KeyPress(Sender: TObject; var Key: Char);
var
AItem: TListItem;
i: Integer;
isFound: Boolean;
begin
if key = #13 then
begin

AItem := ListView1.FindCaption(nFount, Trim(edt1.Text), True, False, true);

if not Assigned(AItem) then
begin
isFound := False;
for i := 0 to ListView1.Items.Count - 1 do
begin
if Trim(edt1.Text) = ListView1.Items.Item[i].SubItems[0] then
begin
nFount := 0;
isFound := True;
ListView1.Selected := ListView1.Items[i];
ListView1.Items[i].MakeVisible(True); //定位后显示出来
Break;
end
else if (i = ListView1.Items.Count - 1) and not isFound then
begin
MSGWarning(‘没有找到该操作员‘);
nFount := 0;
Break;
end;
end;
end
else
begin
ListView1.Selected := AItem;
AItem.MakeVisible(True); //定位后显示出来
if ListView1.Selected.Caption = Trim(edt1.Text) then
nFount := 0
else
nFount := ListView1.Selected.Index;
end;

ListView1.SetFocus;
end;
end;

listview findCaption

原文:https://www.cnblogs.com/maweiwei/p/11094964.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!