Simplicty and flexibility!


Change Text Colour


Started by Handles
Search
You will need to Sign In to be able to add or comment on the forum!

Change Text Colour

6.53..

I want to change the text colour in a filed from black to red if the filled = 0, so something like , 

(if field2 = 0 tex.colour RED else text.colour Black)

any help please  in correct format 


Written by Handles 27/04/25 at 09:35:31 DataEase 6.x

Re:Change Text Colour

Download Sample
Hi.

This is quite straight forward in DE6 but evern more so in LE9/DE9.

The attached example is in LE9 as we don't do work in DE6 anymore but the first examples should work the same in DE6. 

As you do the action directly on the object you can leave out the object name and use a general reference.

Fully written out it would be:

if DataEase6Compatible.Value="0" then

DataEase6Compatible.fill.color.red :=255 .

DataEase6Compatible.fill.color.green := 0 .

DataEase6Compatible.fill.color.blue := 0 .

else

DataEase6Compatible.fill.color.red :=255 .

DataEase6Compatible.fill.color.green := 255 .

DataEase6Compatible.fill.color.blue := 255 .

end

The benefit of using the general reference is obviously that the code can be copied onto other objects without having to be modified. 

Same goes for the DE9 sample.

Here we use Style rather than RGB. This way you can change the look of the field via changing the style rather than having to change the code on each field. Hard coding is never a good idea as its a big job to "change your mind".

define "retval" text .

if value = "0" then

retval := SetStyle(Name,"Red") .

else

retval := SetStyle(Name,"Normal") .

end

So basically what we do here is to check the value of the current object, if its "0" (value is always text) so if you want to change it to number you can simply do value+0 which will automatically change it to a number. 

we use a dummy variable to call the funciton SetStyle and then we use the property Name which will be the name of the current object and then set the style "Red". or "Normal". You can then change the style Red as much as you please and everywhere its used it will change.


Written by DataEase 28/04/25 at 11:53:24 DataEase 6.x

Re:Re:Change Text Colour

Thanks for the reply, I will give this a try - hopefully all goes well, I have tried the Version VE9 but some of the thing I have program in DE6.53 just will not work in DE9 - and its a very large database too large to start changing thing unfortunatley.   


Written by Handles 28/04/25 at 17:04:45 DataEase 6.x

Re:Re:Re:Change Text Colour

There is a lot of customers that has stayed in DE6 due to problems moving forward due to exstensive use of CDF's and hacks to get things to work "exactly" as they want to.

But we see an increase in people that has stayed in DE6 that now simply have to move forward and obviously the leap to DE9/DE10 will not get any smaller with time passing.

The focus on migration to DE6 was in DE8.2 really where we re-introduced what has been left out in DE7 but due to compatibility with DE7 taking priority there is certain things that one simply had to re-design moving from DE6 and before. 

In LE9/DE9 you have opportunities that one can just dream of in DE8.5 and obviously even more so if one is in DE6. However one will have to put some effort into moving the application forwards but it would be well worth it.

Most of the things that one did a lot of programming to get in DE6 comes for free in LE9/DE9 but one need to look a things with fresh eyes.

One will also be able to "spread ones wings" with options of sharing the Application with our Web Suite that will allow you to build a modern web interface on top of your DE9 application without it affecting the running of that app at all.


Written by DataEase 29/04/25 at 09:31:08 DataEase 6.x

Re:Re:Re:Re:Change Text Colour

I will look at DE9 again - looking at it last time I could see the potential for moving forward with it, but must say it’s scary with so many hidden “If’s and oml’s" hidden all over the place inour program , plus I’m not sure if I will be able to down load another demo version of DE9 as I tested it a year or so ago.   


Written by Handles 29/04/25 at 09:50:12 DataEase 6.x
DG3_ForumList