backcolour to field in form

Hi Friends,

I am trying to give backcoluor in some control in the form . I am using displayoption method on the form datasource.

with this code :

_options.affectedElementsByField(fieldnum(emplTable,Name));
_options.backColor(WinApi::RGB2int(182,220,233)); // light Blue

But this is not working , when i use

_options.affectedElementsByControl(EmplTable_Name.id());

it is working for this control only, my requirement is to colour at all places where this field is used.

pls help

thanks

Do anyone know what is DBFHdl2Int() function and how it is used

Hi,

Instead of using display option() method, use active method.

Just change the auto declaration of the required cell to “Yes”…

lets say it is field1(name of the field in design)… in table1…

public int active()
{
int ret;
;

if (table1.stock == 0)
{
field1.colorScheme(FormColorScheme::RGB);
field1.backgroundColor(Winapi::rgb2int(255,0,0));
}
else
{
field1.colorScheme(FormColorScheme::RGB);
field1.backgroundColor(Winapi::rgb2int(255,255,255));
}

ret = super();

return ret;
}

This might help you… use the same for all the controls wherever it is necessary…