change fgcolor programatically

Questions and answers for designing and implementing forms in Servoy

change fgcolor programatically

Postby bevil » Thu Mar 12, 2015 12:57 pm

I have changed over a solution from using onrender to using css, and one unexpected problem is that it seems that many lines were added with white foregrounds, so with css, the text is white text on white background. There are too many to change manually (although weirdly, not all lines are white - I guess it is a default colour on some clients' machines, and not others...)

Anyway, I am now trying to loop through the lines and change them all to black, however simply setting a fgcolor of black does not work as they are rtf fields. Do I need to parse the rtf and replace all the colours with black?

Any easier way to do this?

Thanks

Bevil
bevil
 
Posts: 163
Joined: Thu Oct 18, 2012 7:31 pm

Re: change fgcolor programatically

Postby mboegem » Thu Mar 12, 2015 1:24 pm

Hi Bevil,

in css you can also set the foreground color, ie:
Code: Select all
odd {
   background-color: #F7F7FF;
   color: #000000;
}

even {
   background-color: #FFFFFF;
   color: #000000;
}

selected {
   background-color: #CEDFFF;
   color: #000000;
}


But I don't think that rtf fields will really care about the color property in css.
It seems strange that the onRender would behave differently from the css, applying the foreground color.
I would expect these rtf fields to be displayed the same...

If you really want to get rid of the foregrounds you could do a search on the workspace *.frm files and look for this property in order to delete it.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1750
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: change fgcolor programatically

Postby bevil » Thu Mar 12, 2015 1:40 pm

Hi Marc.

Thank you for the reply.

Yes, that is how my CSS looks already (I used the example.)

I don't want to remove the fg, I just want to programatically set it to black with a loop through all lines. However since it is in rtf markup, I think it might be a little tricky..

There is a rtf > html > rtf method from Bob, which Robert updated, which I might try (switch it to html and do my loop through that)
bevil
 
Posts: 163
Joined: Thu Oct 18, 2012 7:31 pm

Re: change fgcolor programatically

Postby mboegem » Thu Mar 12, 2015 1:58 pm

If it used to work with onRender, you might as well consider to just set an onRender on the few(?) rtf field you use.
Within the onRender you just set the foreground to black.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1750
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests