Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

Is there a plugin which will enable me to assign a color to a container field by a script which uses RGB fields to set the color of the container?

Posted (edited)

I believe this can be done without requiring a plugin. Can you explain why you need this?

 

--
P.S. What's up with the title?

Edited by comment
Posted

Hi Guy,

comment is correct that you can accomplish this without any of our plugins. You can change the background color of a container by changing its Fill setting to a color under the appearance tab in the inspector panel. I don't believe there is a way to change the fill color in FileMaker using a script.

However, a workaround is to have the container's fill color be set to "None", and have some rectangle objects hidden behind that container that will show up with conditional formatting.

With our SuperContainer plugin, we do have an an option to change the background color of our SuperContainer. You can take a look at that option here in our documentation http://docs.360works.com/index.php/SuperContainer#Customizing_SuperContainer_Appearance.

This also may be accomplishable with our ScriptMaster plugin, which utilizes Groovy to execute Java code, but we do not have an example module that does what you're asking so you would have to figure out how to write the Groovy code for that. We do offer consulting for custom work if that's something you are interested in having developed for you.

Posted
37 minutes ago, nick360Works said:

have some rectangle objects hidden behind that container that will show up with conditional formatting.

You cannot use conditional formatting to change a color of an object to arbitrary RGB values.

 

38 minutes ago, nick360Works said:

I don't believe there is a way to change the fill color in FileMaker using a script.

But there is a way to change the color of the image shown in a container field, using a calculation. Still, if the purpose is to create a colored rectangle - e.g. to serve as a background - the simplest solution is to use text and color it using the TextColor() function which accepts RGB values as its input.

 

Posted
14 hours ago, comment said:

the simplest solution is to use text and color it using the TextColor() function which accepts RGB values as its input.

 

I thought that was an interesting option and looked into how to apply that. But Textcolor changes the color of the actual text in a field (or variable) not the background. Can you give an example how to color a background ( I assume a text object) using this?

Posted (edited)
20 hours ago, OlgerDiekstra said:

But Textcolor changes the color of the actual text in a field

Yes, that is the idea. Use a rectangle character, such as Char ( 61543 ) in Webding font, or Char ( 9632 ), and make the font size very large.

 

Edited by comment
Posted (edited)

Cool. Might come in handy sometime.

For those interested in this, here's code that will make this work:

Place a text object on a layout and give it the value <<$$BG>>, or whatever suits.

Use a script with the following code to control the color:

Set Variable [$$BG; Value: "g"]
Set Variable [$$BG; Value: TextFont( $$BG; "webdings" )]
Set Variable [$$BG; Value: TextSize( $$BG; 1000 )]
Set Variable [$$BG; Value: TextColor( $$BG; RGB( 128; 128; 128 ) )]
Refresh Window []

Size and color can now be set dynamically. These variables can of course be merged into one.

Char( 61543 ) that Comment used above is actually "g" in webding.

Edited by OlgerDiekstra
Posted
5 hours ago, OlgerDiekstra said:

Char( 61543 ) that Comment used above is actually "g" in webding.

Not exactly. "g" is actually Char ( 103 ). A long time ago, you could type "g" and format it as Webding font to get a rectangle. This stopped working on MacOS years ago, in all applications, including Filemaker. I have just now checked and it does work again in FMPA 17, but not in other applications. 

Posted

Ha, I don't have a Mac to play with. Windows only. But you have a point. Refreshing my memory (ie googling) learns that webdings, wingdings etc are not reliable on webpages, and probably also not across platforms. Unicode (which is what Char() produces) is (or supposed to be) reliable on webpages and across platforms. From what I've read, webdings and wingdings (the latter I knew) is geared towards Windows. Other plaforms may have implemented parts or the whole but there's no guarantee. In fact, Web/wingdings displays best in IE. That says enough really.

So we're best off to use Char( 61543 ).

Thanks Comment!

This topic is 2049 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.