5,388
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.ListBox1DblClick(Sender: TObject);
var
i:integer;
begin
{-------------ListBox1的双激事件------------------}
if ListBox1.Items.Count>0 then
if not(ListBox1.ItemIndex=-1) then
begin
with Memo1 do begin
i:=Lines.IndexOf(ListBox1.Items.Strings[ListBox1.ItemIndex]);{-刚才这里漏了个等号-}
if i>=0 then begin
SelStart:=SendMessage(Memo1.Handle,EM_LINEINDEX,i,0);
SetFocus;
SelLength:=length(ListBox1.Items.Strings[ListBox1.ItemIndex]);
end;
end;
end;
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
var
i:integer;
begin
{-------------ListBox1的双激事件------------------}
if ListBox1.Items.Count>0 then
if not(ListBox1.ItemIndex=-1) then
begin
with Memo1 do begin
i:Lines.IndexOf(ListBox1.Items.Strings[ListBox1.ItemIndex]);
if i>=0 then begin
SelStart:=SendMessage(Memo1.Handle,EM_LINEINDEX,i,0);
SetFocus;
SelLength:=length(ListBox1.Items.Strings[ListBox1.ItemIndex]);
end;
end;
end;
end;
procedure TForm1.l_inlist(str:string);
var
i:integer;
begin
{-----其中str参数是要查找的字串--------}
for i :=0 to Memo1.Lines.Count-1 do
if pos(AnsiUpperCase(str),AnsiUpperCase(Memo1.Lines.Strings[i]))>0 then
ListBox1.Items.Add(Memo1.Lines.Strings[i]);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
{--edit1输入要查找的字串,也就是你说的ora开头的字串}
l_inlist(edit1.Text);
end;