Jump to content

Recommended Posts

Posted

How to set the color of a column based on a cell row,column string content?

uniStringGrid.Columns[i].Color:= clGreen; has now effect

-Scott

 

Posted
4 minutes ago, 1938 said:

How to set the color of a column based on a cell row,column string content?

Hello,

You can use OnDrawCell event, for example:

procedure TMainForm.UniStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  var Value: string; Attribs: TUniCellAttribs);
begin
  if ACol = 2 then
  begin
    Attribs.Font.Color := clGreen
  end;

end;
\FMSoft\Framework\uniGUI\Demos\Desktop\GridCellStyle

 

Posted

Is there any way to do the entire column?  If an item in row 2 for example is a value, I want the entire column to be a color?

 

Use case:  If column 4 row 2 is "Sunday" I want the entire column 4 background color to be green.

 

-Scott

Posted
14 minutes ago, 1938 said:

Is there any way to do the entire column?  If an item in row 2 for example is a value, I want the entire column to be a color?

Hmm, I think, under such a condition, this event will not work.

Posted
So,
On a blank form I drop a uniStringGrid.
Add 3 columns.
set row count to 4.
set Using the object inspector for column[2] I set the color to green.
No effect.

I can determine the columns  that will have the different background colors ahead of time with some extra work, but even if I do, the column  color has no effect.  Am I doing something wrong?  Shouldn't I be able to set both column color and row color?  

-Scott

 

 

Posted

I think that at some point I may end up using a dbgrid.  Here is what I'm after.  I don't seem to be able to figure out a way to do it via uniGUI.  

 

Capture.PNG.6284f6e0d87894d60f65bb189d1e0102.PNG

Posted

After looking at using DBGrid, the column color works but does not extend to the fixed column cell at the top.  But I lose the ability to specify fixed rows and fixed columns.  I need 2 title lines at the to.  Plus still no way to manage cell outline colors.  

These grids definitely need some attention.  I could patch some of this but even with the source,  I can't build due to select missing .pas files. For example, cell color being forced to clWhite by default in StringGrid which overrides the column color method of the component.  :-(

-Scott

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