Re: Adding combobox to grid?



"brett" schrieb:

I couldn't find that property but there are similar ones, such as
goColSizing that I've read about. I don't have the IDE in front of me
now but are you saying in the Object Inspector for XStringGrid
properties, I'll see an options property?

Yes, of course. Like every standard StringGrid, also XStringgrid has an
options property. And within the options you find goEditing as well as
goColSizing.

Also, how do I insert a new row at runtime? I've set the rows to 2
(header and one new row).

Perhaps there are better solutions but I increase the RowCount by 1 and copy
the Rows below the 'new' row to one row down. This code insert a new row at
the current cursor position:
....
xg:TXStringGrid;
....
procedure TMyForm.InsertRow;
var aRow,acol:integer;
begin
xg.RowCount:=xg.RowCount+1;
for aRow:=xg.RowCount-1 downto xg.Row+1 do begin
for acol:=1 to xg.ColCount do
xg.Cells[acol,arow]:=xg.cells[acol,arow-1]
end;
for acol:=1 to xg.ColCount do
xg.Cells[acol,arow]:='';
end;


I was thinking it would grow at run time
after I tabbed past the combo box column (my last column).

No. Why should it do so?
If you want this functionallity, you must implement it yourself

Regards
Burkhard


.