:: Changing a color fields in tab panel ::

I need change the text, bg, fg color of some records in a tab panel accordingly by status field. Could this be possible?

ie. code:

if _status = 'a'
   the color fields of this record = blue

if _status = 'b'
   the color fields of this record = red

If this is possible. How can i do that?

Thanks :)

zoo:
If this is possible. How can i do that?

Hi Zoo, in Servoy you can attach a rowBGCalculation to your form. The method (global) should look like this:

/**
 * Calculate the row background color.
 *
 * @param {Number} index row index
 * @param {Boolean} selected is the row selected
 * @param {String} elementType element type
 * @param {String} dataProviderID element data provider
 * @param {String} formName form name
 * @param {JSRecord} record selected record
 * @param {Boolean} edited is the record edited
 *
 * @returns {Color}
 */
function rowBGColorCalculation(index, selected, elementType, dataProviderID, formName, record, edited) {
	
	if (selected)
		return '#FF0000';
	else if (index % 2)
		return '#77FF77';
	else
		return '#77DD77';
}

From the ‘record’ arguments you can read the value of your status field, something like:

if(record.status == 'a') etc.

As of the methodname you can deduct that this only applies to the background color.
If you need to change the foregroundcolor as well, you’ll need to create a calculation and format your text by returning html.

To show this html text on a form you need to choose an element of type ‘html area’ (don’t forget to disable the scrollbars of this type of element).
Another option is to show the dataprovider on a label.
There’s pro’s & cons for both types.

I don’t like this way of formatting the foreground properties at all. But as it’s the only choice we have so far it just leaves no other choice.

Hope this helps!

Yeeees, a lot complicate for me, but i did it :)

Thanx