mjcramos Posted August 2, 2017 Share Posted August 2, 2017 procedure TfNFCe.GridDeleteRow(RowNumber: Integer; Grid: TUniStringGrid);var i: Integer;begin Grid.Row := RowNumber; if (Grid.Row = Grid.RowCount - 1) then Grid.RowCount := Grid.RowCount - 1 else begin for i := RowNumber to Grid.RowCount - 1 do Grid.Rows := Grid.Rows[i + 1]; Grid.RowCount := Grid.RowCount - 1; end;end; I have a function to delete the line from a stringgrid vcl, how could I use it in the stringgrid of unigui? There is no rows property Grid.Rows := Grid.Rows[i + 1]; ---> not working Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 2, 2017 Share Posted August 2, 2017 Hi, Maybe like this for now? For example: procedure TMainForm.UniButton1Click(Sender: TObject); var I, J, ARow: Integer; begin ARow := 2; with UniStringGrid1 do begin BeginUpdate; for I := ARow to RowCount - 2 do for J := 0 to ColCount - 1 do Cells[J, I] := Cells[J, I+1]; RowCount := RowCount-1; EndUpdate; end; end; Best regards, Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 2, 2017 Share Posted August 2, 2017 Or like this: procedure DeleteRow(ARowIndex: Integer; AGrid: TUniStringGrid); var I, J: Integer; begin with AGrid do begin BeginUpdate; if (ARowIndex = RowCount) then RowCount := RowCount - 1 else begin for I := ARowIndex to RowCount - 2 do for J := 0 to ColCount - 1 do Cells[J, I] := Cells[J, I + 1]; RowCount := RowCount - 1; end; EndUpdate; end; end; 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.