Simplicty and flexibility!


Function::Internal

SetColor
SetColor("objectname#number(optional)","font","fill","border")
SetColor("MyField","-1","#00ff00","-1")
SetColor(concat("MyField#",MyRecordNr),"#ff0000","-1","#ff0000")


To change the color of an object during runtime. You can change font, fill and border color. 

Parameters


ObjectName#number(optional)

This is the Object name (not the field name) of the object. It will alway have to be presented between "" i.e. "myfield". It is case sensitive and you need to make sure that there are no leading or trailing spaces. 


Object names are mostly unique in a form, but when you use a Subform the same object names might be repeated many times (cloning) and as the subform is another form object inside the form the original object names from the main form might be repeated.

You can change object names both in main and sub forms, but you cannot get unique names for object names in a multiple record view. To get around this we have included an optional counter so you can decide which of the many similarly named objects you want to manipulate.

"MyField#8" will change the object number 8 in the form. Remember that it counts from top to bottom and left to right. One pixel higher and an object is before in the object order. All clones (subforms) will be in order and after each other.

Font

Text value for the RGB code for font. Preceded with # means hex value. 
-1 is interpreted as Inherit original colour i.e. no change.


Fill

Text value for the RGB code for fill. Preceded with # means hex value. 

-1 is interpreted as Inherit original colour i.e. no change.

Border

Text value for the RGB code for border. Preceded with # means hex value. 
-1 is interpreted as Inherit original colour i.e. no change.



Returns/Result


Nothing

Examples


Reference

Sets the border, fill and font color of a Field or a button.

SetColor("ObjectName","Font","Fill","Border")

Returns empty string.

Parameters are strings. Important to use Object name with no Spaces behind and case sensitive.

"Font","Fill","Border" are transfered as hex values or Dec. Hex values preceded with #

Ex.

SetColor("Field 1","#ff0000","#00ff00","#0000ff")

See Also


On the forum about SetColor

setcolor() only works intermitently

In November last year I was playing with setcolor() in FIELD DERVIATION SetColor( "testa","-1","#707070","-1") should fill the field called testa a grey colour. Just reminding myself how it works with the intention of buying De8 and...

Product: Dataease [{8}]FIVE. Written by Simon B 12/09/14 at 13:36:54

Re:setcolor() only works intermitently

1. If you want to change the look on any object in DE8 it is better to use SetStyle() than SetColor(). SetColor() was a natural first step, but it only set three different properties i.e. Font, Fill, Border so objects with more properties or lacking t...

Product: Dataease [{8}]FIVE. Written by DataEase Tech Sup. 12/09/14 at 14:23:56

Re:Re:setcolor() only works intermitently

Thanks for the prompt reply.1. The De8 lexicon starts at Abs and stops at percent !  Every function after P is missing.  I've already looked in the blog, and i've looked in the forum.  Can't use...

Product: Dataease [{8}]FIVE. Written by Simon B 12/09/14 at 14:46:52

Re:Re:Re:setcolor() only works intermitently

1. This is useful information ;-) And necessary information. The DE8 website is a mini version of the actual website and obviously "our" people don't use it as nobody as discovered this discrepancy. (If you go on&nbsp;<a href="http://www.dataease.com/...

Product: Dataease [{8}]FIVE. Written by Mr. DataEase 12/09/14 at 15:06:39

setcolor() attempt 2

So here I am again (had to wait a month to download another trial) to try figure out how to make setcolor() work.&nbsp; Forget setstyle(), I have the same problem so i'm sticking with this for now.I have a text field called hist_idn3</s...

Product: Dataease [{8}]FIVE. Written by Simon B 13/11/14 at 16:18:39

Re:setcolor() attempt 2

The first and most obvious problem is that you tell the field to be always green ;-)concat (lookup "entry2ordrecnos" "rgb3",if (hist_idn3 =&nbsp;"dec",SetColor("hist_idn3","-1",...

Product: Dataease [{8}]FIVE. Written by DataEase 13/11/14 at 17:20:54

Re:Re:setcolor() attempt 2

I copy pasted in the 2nd colour as i'd already changed my database test to the 2nd example, but I HAD put in a different colour orginally lol.&nbsp; However!&nbsp; I know I put in 000000 as i thought i knew that was either white or black, either way a...

Product: Dataease [{8}]FIVE. Written by Simon B 14/11/14 at 10:07:25

Re:Re:Re:setcolor() attempt 2

Incidently, the lexicon indicates i can use text value for the RGB code.&nbsp; How do I enter that? i.e. red is&nbsp;R255, G150, B150Tried "255150150" , "255.150.150" , 255,150,150" , can't find how to enter it :) thank you...

Product: Dataease [{8}]FIVE. Written by Simon B 14/11/14 at 10:34:06

Re:Re:Re:setcolor() attempt 2

Equations with more than one unknown....You are right. "#000000" doesn't work. but "#000001" does.. 0 is a difficult thing in programming but still....Talking of being unlucky... sorry....

Product: Dataease [{8}]FIVE. Written by DataEase 14/11/14 at 11:13:12

Re:Re:Re:Re:setcolor() attempt 2

Vi invariably use String as Arguments in functions now. DataEase converts seamlessly between formats and string give many more options later for formatting etc.the number of colours is 24bit i.e. 256x256x256 so you have 255 shades of red,green...

Product: Dataease [{8}]FIVE. Written by DataEase 14/11/14 at 11:16:54

Re:Re:Re:Re:Re:setcolor() attempt 2

I guess an apology is due here for the trouble we have caused you and a big thanks for being so persistent and pointing us in the right direction.Making a great tool need to be a great collaboration between publisher and customer, where we nee...

Product: Dataease [{8}]FIVE. Written by DataEase 14/11/14 at 11:47:09

Re:Re:Re:Re:Re:Re:setcolor() attempt 2

Thank you :)&nbsp; And than you for putting up with me :DI used RGB purely because that's what datease shows.&nbsp; i.e. i find a fill colour that is pastel enough to be read with text over it, I then click define custom colours to find out the...

Product: Dataease [{8}]FIVE. Written by Simon B 14/11/14 at 14:08:58

Re:Re:Re:Re:Re:Re:Re:setcolor() attempt 2

You got it right. Sometimes we just go to far in one direction without looking up and adjusting our bearings...DataEase only use decimal and it is natural that the numbers you find there should be automatically usable in the functions....

Product: Dataease [{8}]FIVE. Written by DataEase 14/11/14 at 14:37:44

Re:Re:Re:Re:Re:Re:Re:setcolor() attempt 2

Simon,&nbsp;Christmas come early this year&nbsp;....SetColor() is now updated to fit with your format.SetColor("MyObject","R128G175B33","G128","#ff0000") ..You only need to insert he elements you want R120 R255B44 etc.Yo...

Product: Dataease [{8}]FIVE. Written by DataEase 19/11/14 at 17:11:47

Re:Re:Re:Re:Re:Re:Re:Re:setcolor() attempt 2

By the way, we have also corrected the blunder of #000000 not being black, but it won't be published until next release due to "late arrival".You can however simply use 0 for any of you new elements.SetColor("MyObject,"R0","R0","R0") w...

Product: Dataease [{8}]FIVE. Written by DataEase 19/11/14 at 17:14:38

Re:Re:Re:Re:Re:Re:Re:Re:Re:setcolor() attempt 2

Thank you :)&nbsp; May be work showing hex values in the colour picker, as that's the reason I use RGB as that and hue/sat/lum are the only values shown :)...

Product: Dataease [{8}]FIVE. Written by Simon B 24/11/14 at 09:40:43

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:setcolor() attempt 2

That would be helpful to, but to be honest it is a drag to add functionality to these old Dialogues. In future versions of DataEase, the dialogues will be made in DataEase and than you could even do it yourself ;-)It is on the list however, so...

Product: Dataease [{8}]FIVE. Written by DataEase 24/11/14 at 10:20:32

SetColor - how to make it fire NOW not wait until you hit save.

I have a control field with ghe following derivation:concat(SetColor("hist_d1","-1",rgb1,"-1"),SetColor("hist_s1","-1",rgb1,"-1"),SetColor("hist_t1","-1",rgb1,"-1"),SetColor("hist_idn1","-1",rgb1,"-1"),SetState("histc01",0)<...

Product: Dataease [{8}]FIVE. Written by Simon B 15/06/15 at 14:02:05

Re:SetColor - how to make it fire NOW not wait until you hit save.

1. Is the field with the derivation&nbsp;concat(SetColor("hist_d1","-1",rgb1,"-1"),SetColor("hist_s1","-1",rgb1,"-1"),SetColor("hist_t1","-1",rgb1,"-1"),SetColor("hist_idn1","-1",rgb1,"-1"),SetState("histc...

Product: Dataease [{8}]FIVE. Written by DataEase 16/06/15 at 09:16:56

Re:Re:SetColor - how to make it fire NOW not wait until you hit save.

1. Yes, the field with the derivation mentioned is a virtual field.2. The field is higher up than field rgb1 (also a virtual derived field)&nbsp; It is the 1st field top left corner to ensure it is the first field to fire.I've followed a...

Product: Dataease [{8}]FIVE. Written by Simon B 16/06/15 at 09:32:44

Re:Re:Re:SetColor - how to make it fire NOW not wait until you hit save.

control field lower than rgb tried, no difference.&nbsp; Lookup entry data from an order screen, I have everything, supplier name, desciptions, prices, history, everythnig is on my screen, nothing is going to change, it just needs to look at whats bee...

Product: Dataease [{8}]FIVE. Written by Simon B 16/06/15 at 10:15:39

Re:Re:Re:SetColor - how to make it fire NOW not wait until you hit save.

Tried adding&nbsp;if (rgb1 not=blankto the start(with ,"" at the end not ,0 as it's a text field and wouldn't accept it)colour changing of fields does not work until you save them. Once saved they show correct all the time,...

Product: Dataease [{8}]FIVE. Written by Simon B 16/06/15 at 10:24:04

On the blog about SetColor

New Function in 8 - SetColor() - Change the Fill, Border and Font of Fields/Buttons (Ver. 8.0.0.1158)

This is the last function in the triumvirate, SetFocus()- SetState() and SetColor(). With this last function you will now be able to set the focus/cursor on a Field/Button, hide/show, enable/disable and finally change the appearance from a derivation or...

Product: Dataease [{8}]FIVE. Written by DataEase 19/11/12 at 19:44:55

DataEase 8 - Small Sample to show off SetState(),SetFocus(),SetColor(),SetLabelText() (Ver. 8.0.0.1281)

This is just a small sample to show off SetState() - &nbsp;Hiding/showing/disabling/enabling of fields/buttons and other GUI objects, SetFocus() - set focus on any field or button etc that you want to have the...

Product: Dataease [{8}]FIVE. Written by DataEase 27/04/13 at 09:17:21

Update Functionality DataEase 8 - SetValue(), SetState(), SetColor(), SetFocus() ObjectNumber Added (Ver 8.0.0.1306)

One challenge that has been present since OML was introduced and one could start to manipulate GUI object directly is to manipulate different Rows/Records in a Subform etc.Record objects in Subforms are clones, and hence don't have their own u...

Product: Dataease [{8}]FIVE. Written by DataEase 18/06/13 at 22:08:56

DataEase 8.2 - SetColor() updated with Decimal Interpretation R255G128 etc... (Ver. 8.2.0.1691)

It was pointed out to us that we might have been to technical and not particularly user friendly when we designed the SetColor() function.After a lot of protesting, soul searching and deliberation and with the weight of tradition heavy on the...

Product: Dataease [{8}]FIVE. Written by DataEase 19/11/14 at 16:51:31

DataEase 8.5 - SetState(), SetStyle(), SetColor(), MoveObject() all now support wildcard (Ver. 8.5.0.2001)

New Features create New Demands....SetState(), SetStyle(), SetColor() and MoveObject() are between the most popular and besides ExecDQLClass the most used new features in DataEase 8.We very quickly realised that you needed to be able t...

Product: Dataease [{8}]FIVE. Written by DataEase 01/12/15 at 15:06:26


dg3_HelpView