Jump to content

TUniStringGrid Rows[i]


mjcramos

Recommended Posts

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

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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;
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...