Jump to content

TUniStringGrid


MOGSY

Recommended Posts

Hi

How can we change the column width dynamicaly, depending on the content of the first row. Is it possible to hide a column depending on data in the column?

        if uniStringGrid1.Cells[thisColumn, 1] = 'Test Data' then begin
          strgCars.Columns[thisColumn].Width := 0

       else
          strgCars.Columns[thisColumn].Width := 100;
 

Link to comment
Share on other sites

4 minutes ago, MOGSY said:

How can we change the column width dynamicaly, depending on the content of the first row. Is it possible to hide a column depending on data in the column?

Hi,

Can you please explain in more detail?

uniStringGrid1, strgCarsWhat kind of control, and how are they related?

Link to comment
Share on other sites

sorry for spelling error. I would like to hide some column in string grid either by setting the width to zero or any other suggestion.

        if uniStringGrid1.Cells[thisColumn, 1] = 'Test Data' then begin
          uniStringGrid1.Columns[thisColumn].Width := 0

       else
          uniStringGrid1.Columns[thisColumn].Width := 100

Link to comment
Share on other sites

Hi

Thanks for the link, i have tried it but I do not receive the _edit event.

What I would like to do is check the second row data on each column "ignoring the title row" and if it has no data, then I would like to hide that column.

I was thinking if I could set the width of the column to zero then the column is hiden. This works in delphi.

Link to comment
Share on other sites

6 hours ago, Sherzod said:

Hi, 

Can you make a simple testcase for check? 

procedure TFrameTesting.strgDrawCell(Sender: TObject; ACol,
  ARow: Integer; var Value: string; Attribs: TUniCellAttribs);
var
  S,aStat : string;
begin
  S:=TUniStringGrid(Sender).Cells[ACol, ARow];
  Attribs.Font.Size := 12;
  if aRow = 0 then Attribs.Font.Size := 10 else begin
  aStat := getStatus(S);
    if aStat = 'CLN' then begin
      Attribs.Font.Color:=clYellow;
      Attribs.Font.Style:=[fsBold];
    end else if aStat = 'CLR' then begin
      Attribs.Font.Color:=clGreen;
    end else if aStat = 'RES' then begin
      Attribs.Font.Color:=clGray;
    end else if aStat = 'POG' then begin
      Attribs.Font.Color:=clRed;
    end else if aStat = 'SOL' then begin
      Attribs.Font.Color:=clBlue;
    end else begin
      (sender as TUniStringGrid).Columns[ACol].Width := 0;
    end;
  end;
end;

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...