Thursday, 10 January 2013

How change the color of a single colum not the entire row


You can override the displayOption() method of the form's datasource 
to change appearance of any row in the grid. U can set either the 
foreground or the background color of the row.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
   _options.backColor(WinApi::RGB2int(0,255,0)); 
} 

For highlighting one or more cells, override the 

To highlight one or more individual cells, use 
the ._options.affectedElementsByControl() method. 

public void displayOption(Common _record, FormRowDisplayOption _options)
{
  _options.backColor(WinApi::RGB2int(0,255,0));
  _options.affectedElementsByControl(Control1.id());
  _options.affectedElementsByControl(Control2.id());
} 

Remember one thing, u can change multiple cells this way but u cant 
assign different colors to different cells. U have to use only one 
color for any of the cells in the row.

4 comments:

  1. thanks for posting this ...it is very usful ......

    ReplyDelete
  2. How can I set it upon field modified and not in Form datasource

    ReplyDelete