1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
begin
with StringGrid1 do
if ACol = 1 then
if Length(Value) < 2 then
ListBox1.Clear
else
SearchNextValue(Value);
end;
procedure TForm1.SearchNextValue(S: string);
var
x, y: integer;
begin
ListBox1.Clear;
S:= LowerCase(S);
with StringGrid2 do
for y:= 0 to ColCount - 1 do
for x:= 0 to RowCount - 1 do
if Pos(S, LowerCase(Cells[y,x])) = 1 then
ListBox1.Items.Add(Cells[y,x]);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
with ListBox1, StringGrid1 do
if ItemIndex >= 0 then
Cells[Col, Row]:= Items[ItemIndex];
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; aCol, aRow: Integer;
var CanSelect: Boolean);
begin
ListBox1.Clear;
end; |
Partager