Jump to content

GetRGB(field)...


This topic is 7001 days old. Please don't post here. Open a new topic instead.

Recommended Posts

(as always, i'm sorry for my English)

GetRGB(field)...

...isn't a standard function of FM7 !!

it gives the color of the text inside a field in the RGB(RRR;GGG;BBB)format.

How you'll build that ??

Link to comment
Share on other sites

(as always, i'm sorry for my English)

GetRGB(field)...

...isn't a standard function of FM7 !!

it gives the color of the text inside a field in the RGB(RRR;GGG;BBB)format.

How you'll build that ??

Link to comment
Share on other sites

Hi, comment

very good and ... very quick!!

I have thought to use GetAsCSS() to.

Thank you very much

p.s. I think that there is something wrong... if you cancel the text field and write something else, the function don't evaluate correctly!(sorry)

Link to comment
Share on other sites

Hi, comment

very good and ... very quick!!

I have thought to use GetAsCSS() to.

Thank you very much

p.s. I think that there is something wrong... if you cancel the text field and write something else, the function don't evaluate correctly!(sorry)

Link to comment
Share on other sites

Hi, comment

very good and ... very quick!!

I have thought to use GetAsCSS() to.

Thank you very much

p.s. I think that there is something wrong... if you cancel the text field and write something else, the function don't evaluate correctly!(sorry)

Link to comment
Share on other sites

There is a problem with Black RGB(0;0;0) !

My Italian version of GetAsCSS(field) gives me :<SPAN STYLE= "color: #000000;" >Black</SPAN> but your attachment gives: <SPAN STYLE= "">Black</SPAN>

Link to comment
Share on other sites

There is a problem with Black RGB(0;0;0) !

My Italian version of GetAsCSS(field) gives me :<SPAN STYLE= "color: #000000;" >Black</SPAN> but your attachment gives: <SPAN STYLE= "">Black</SPAN>

Link to comment
Share on other sites

There is a problem with Black RGB(0;0;0) !

My Italian version of GetAsCSS(field) gives me :<SPAN STYLE= "color: #000000;" >Black</SPAN> but your attachment gives: <SPAN STYLE= "">Black</SPAN>

Link to comment
Share on other sites

I correct your attachment in this way:

1) field text = auto-enter calculation replaces existing value

2) calculation: If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

... but it's no good if black text comes after coloured text !

Link to comment
Share on other sites

I correct your attachment in this way:

1) field text = auto-enter calculation replaces existing value

2) calculation: If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

... but it's no good if black text comes after coloured text !

Link to comment
Share on other sites

I correct your attachment in this way:

1) field text = auto-enter calculation replaces existing value

2) calculation: If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

... but it's no good if black text comes after coloured text !

Link to comment
Share on other sites

1. I have replaced the attachment after fixing a small bug I have noticed.

2. My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

3. The function evaluates when you click outside the text field (like any other calculation). At least that's what's happening at my end.

4.

If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

What does this achieve? It appears to do nothing: if the text has no color attribute, replace it with black text?

Link to comment
Share on other sites

1. I have replaced the attachment after fixing a small bug I have noticed.

2. My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

3. The function evaluates when you click outside the text field (like any other calculation). At least that's what's happening at my end.

4.

If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

What does this achieve? It appears to do nothing: if the text has no color attribute, replace it with black text?

Link to comment
Share on other sites

1. I have replaced the attachment after fixing a small bug I have noticed.

2. My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

3. The function evaluates when you click outside the text field (like any other calculation). At least that's what's happening at my end.

4.

If ( GetRGBvalues ( text ) <>""; text; TextColor ( text; RGB ( 0; 0; 0) ))

What does this achieve? It appears to do nothing: if the text has no color attribute, replace it with black text?

Link to comment
Share on other sites

Hi comment

I downloaded your second attachment ...

If you cancel the Text field and after write something, the Text field is writed black, so I expected to see cGetRGB to show 0;0;0 but it shows: "no color is definited"

My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

Yes, I wish to see RGB(0;0;0)...but never appears!

Link to comment
Share on other sites

Hi comment

I downloaded your second attachment ...

If you cancel the Text field and after write something, the Text field is writed black, so I expected to see cGetRGB to show 0;0;0 but it shows: "no color is definited"

My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

Yes, I wish to see RGB(0;0;0)...but never appears!

Link to comment
Share on other sites

Hi comment

I downloaded your second attachment ...

If you cancel the Text field and after write something, the Text field is writed black, so I expected to see cGetRGB to show 0;0;0 but it shows: "no color is definited"

My version indeed does not tag black text with a color attribute. If you don't want to see RGB ( 0; 0; 0 ), you can simply wrap the CF in a Substitute() function and remove it.

Yes, I wish to see RGB(0;0;0)...but never appears!

Link to comment
Share on other sites

OK, I think now I understand what you want. Here's the thing: it says "no color is defined", because... no color is defined.

You say you want to see RGB(0;0;0) in such case - but that is not correct. Switch to layout mode, and define another text color for the field, and you'll see why this cannot work.

Imagine you have the same field on different layouts, or even duplicated on the same layout, and each instance is formatted with a different color. There is no way a calculation can access this information. The only indication is the CSS and this is empty - unless a color has been expressly defined to override the default setting.

Perhaps it would be possible to determine if there is text WITHOUT a color tag, and if so, stick a RGB(0;0;0) tag in between. But I am not going to try.

What's this good for anyway?

Link to comment
Share on other sites

OK, I think now I understand what you want. Here's the thing: it says "no color is defined", because... no color is defined.

You say you want to see RGB(0;0;0) in such case - but that is not correct. Switch to layout mode, and define another text color for the field, and you'll see why this cannot work.

Imagine you have the same field on different layouts, or even duplicated on the same layout, and each instance is formatted with a different color. There is no way a calculation can access this information. The only indication is the CSS and this is empty - unless a color has been expressly defined to override the default setting.

Perhaps it would be possible to determine if there is text WITHOUT a color tag, and if so, stick a RGB(0;0;0) tag in between. But I am not going to try.

What's this good for anyway?

Link to comment
Share on other sites

OK, I think now I understand what you want. Here's the thing: it says "no color is defined", because... no color is defined.

You say you want to see RGB(0;0;0) in such case - but that is not correct. Switch to layout mode, and define another text color for the field, and you'll see why this cannot work.

Imagine you have the same field on different layouts, or even duplicated on the same layout, and each instance is formatted with a different color. There is no way a calculation can access this information. The only indication is the CSS and this is empty - unless a color has been expressly defined to override the default setting.

Perhaps it would be possible to determine if there is text WITHOUT a color tag, and if so, stick a RGB(0;0;0) tag in between. But I am not going to try.

What's this good for anyway?

Link to comment
Share on other sites

thank you very much for your kind replay

You are right, of course !

So, it seems that CSS access the information about the color of text field only if it is different from that I had assigned in layout mode...

for example, if I give it "Yellow" in layout mode, when I write something in Black in Browse mode, I finally have the RGB(0;0;0)...

Link to comment
Share on other sites

thank you very much for your kind replay

You are right, of course !

So, it seems that CSS access the information about the color of text field only if it is different from that I had assigned in layout mode...

for example, if I give it "Yellow" in layout mode, when I write something in Black in Browse mode, I finally have the RGB(0;0;0)...

Link to comment
Share on other sites

thank you very much for your kind replay

You are right, of course !

So, it seems that CSS access the information about the color of text field only if it is different from that I had assigned in layout mode...

for example, if I give it "Yellow" in layout mode, when I write something in Black in Browse mode, I finally have the RGB(0;0;0)...

Link to comment
Share on other sites

This topic is 7001 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.