das steht bei mir in der tabselectcell prozedur
Code:
var R: TRect;
i: integer;
begin
if (ACol = 1) and (ARow > 0) then
begin
R := Tab.CellRect(ACol, ARow);
R.Left := R.Left + Tab.Left;
R.Right := R.Right + Tab.Left;
R.Top := R.Top + Tab.Top;
R.Bottom := R.Bottom + Tab.Top;
with Combobox1 do
begin
ItemIndex := Items.IndexOf(Tab.Cells[ACol, ARow]);
Left := R.Left + 1;
Top := R.Top + 1;
Width := (R.Right + 1) - R.Left;
Height := (R.Bottom + 1) - R.Top;
Visible := True;
SetFocus;
end;
end;
CanSelect := True;
end;
und das im programm:
Code:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
Tab.Cells[Tab.Col, Tab.Row]:=ComboBox1.Items[ComboBox1.ItemIndex];
ComboBox1.Visible := False;
Tab.SetFocus;
end;
procedure TForm1.ComboBox1Exit(Sender: TObject);
begin
Tab.Cells[Tab.Col, Tab.Row]:=ComboBox1.Items[ComboBox1.ItemIndex];
ComboBox1.Visible := False;
Tab.SetFocus;
end;