先试一下,不行再说。
procedure TForm1.Edit3Change(Sender: TObject);
var
i, j: Integer;
begin
with ListBox1.Items do
begin
for i := 0 to Count-1 do
if Pos(Edit3.Text,Strings)=1 then break;
if i<Count then
begin
j := Length(Edit3.Text);
Edit3.Text := ListBox1.Items.Strings;
i := Length(Edit3.Text);
Edit3.SelStart := j;
Edit3.SelLength := i-j;
end;
end;
end;
procedure TForm1.Edit3Change(Sender: TObject);
var
i, j: Integer;
begin
with ListBox1.Items do
begin
for i := 0 to Count-1 do
if Pos(Edit3.Text,Strings)=1 then break;
if i<Count then
begin
j := Length(Edit3.Text);
Edit3.Text := ListBox1.Items.Strings;
i := Length(Edit3.Text);
Edit3.SelStart := j;
Edit3.SelLength := i-j;
end;
end;
end;
老是贴不上来
procedure TForm1.Edit3Change(Sender: TObject);
var
i, j: Integer;
begin
with ListBox1.Items do
begin
for i := 0 to Count-1 do
if Pos(Edit3.Text,Strings)=1 then break;
if i<Count then
begin
j := Length(Edit3.Text);
Edit3.Text := ListBox1.Items.Strings;
i := Length(Edit3.Text);
Edit3.SelStart := j;
Edit3.SelLength := i-j;//能反过来就好
end;
end;
end;
1、申请一个动态数组 S :array of string;
2、procedure TForm1.FormCreate(Sender: TObject);
begin
SetLength(S,100);
n:=0;
end;
3、将EDIT中的输入存入S;
4、procedure TForm1.Edit1Change(Sender: TObject);
var
i :integer;
begin
if Edit1.Text='' then Exit;
for i:=0 to n do
begin
if Copy(S,0,length(Edit1.text))=Edit1.Text then
begin
Edit1.text :=S;
Break;
end;
end;
end;
先实现一部分,下一次 :!
procedure TForm1.ComboBox1Change(Sender: TObject);
var
i, j: Integer;
begin
if ComboBox1.Tag=1 then Exit;
with ComboBox1.Items do
begin
for i := 0 to Count-1 do
if Pos(ComboBox1.Text,Strings)=1 then break;
if i < Count then
begin
j := Length(ComboBox1.Text);
ComboBox1.Text := ComboBox1.Items.Strings;
i := Length(ComboBox1.Text);
ComboBox1.SelStart := j;
ComboBox1.SelLength := i-j;
end;
end;
end;
procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#8 then ComboBox1.Tag := 1 else ComboBox1.Tag := 0;
end;
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
i,oldlen:integer;
begin
if key in [8,37..40] then exit;
for i:=0 to listbox1.Items.Count-1 do
begin
if pos(edit1.text,listbox1.Items)=1 then
begin
oldlen:=length(edit1.text);
edit1.Text:=listbox1.items;