Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I would like to change the color of a rectangular object in my file with different buttons. How can I make this happen?   I would like to make a color change script . I don't know how to script that kind of change.

After looking at the file I'm wondering how setting the field changes th colour.

It's by conditional formatting, Rick. :-)

 

BTW, here is another option.  This one doesn't require any fields and only a single script.  Notice that the colour block has its object named to 'colour' ... this is what refreshes the layout using Refresh Object[] ...  new and powerful but not hoggish in 13.  Otherwise script parameter handles it just fine.

 

The block is simply a drawn button but you can use a text block as well - whatever can be used with conditional formatting.  

colors.fmp12.zip

 new and powerful but not hoggish in 13.  

 

...But the OP has only FMP12.

Thanks for catching that, Doug!  Then a Refresh Window[] should do the job.  


On second thought ... use the old trick of using Freeze Window instead ... that should work fine and have less impact. :-)

Thanks LaRetta,

 

     Of course that's the one thing I didn't see.

 

Rick.

Here there is another one: the rectangular object being a web viewer.

colors.zip

Daniele, I think that the web viewer expression must be

"data:text/html,
<html>
<body margin='0' style=border:'0' bgcolor=#" & 
Table::Red 
 & 
Table::Green 
 &
Table::Blue  & "
>
</body>
</html>"

And the Red, Green, and Blue values must be in hex.  There is no rgb() function in html.

 

It should also be noted that LaRetta's solution using variables instead of a field will mean that the color will not be persistent upon closing and re-opening the solution, if that is important to Hartmut's solution.

 

 

There is no rgb() function in html.

 

If it had not existed, my example would not work.

See: http://www.w3schools.com/html/html_colors.asp where you could see that colors can be set by hex, rgb and name.

 

Other examples ( your and LaRetta's ) involve a fixed number of colors, but the one I proposed leave the user free to choose any persistent color.

Hi Doug,

 

We have not been given the purpose here so we all are guessing anyway.  However, if there were logic beneath the button clicks, which depend upon the underlying data and thus the colours should remain after the User closes, that can easily be incorporated into the solution.  Conditional formatting responds to any calculations such as:  If the button 1 is clicked, set a field to 'complete' ... then the conditional format would simply look to the complete field instead.  The functionality remains the same.

 

Nice example, Daniele!  It reminds me of a file by Comment from 2008 called colors_x11.fp7 where one can specify the colours.  I wanted to suggest it as an alternate as well but couldn't find the post.  In all, Hartmut now has options and that is what counts!

Well, this is awkward.

 

Hex (my revision)

post-75181-0-96147600-1409236193_thumb.j

 

rgb (Daniele's original)

post-75181-0-68929900-1409236213_thumb.j

 

OS is Mavericks; default web browser is Safari.  What is happening here?

rgb (Daniele's original)

attachicon.gifrgb.jpg

 

OS is Mavericks; default web browser is Safari.  What is happening here?

 I do not know but CSS legal color values in RGB is supported in all major browsers

It reminds me of a file by Comment from 2008 called colors_x11.fp7 where one can specify the colours.

 

It 's very likely that Comment has done a similar file, who among us has not done one? :laugh:

Absolutely true!  Over the years, we keep coming around to this functionality over and over!  It's always good to revisit things since our tools change/improve as well and the best tool for the specific job (and our memories) should always be re-evaluated afresh.  

My dilemma is solved.  rgb() is supported for the css background-color property, as Daniele rightly stated, but is not supported for the html bgcolor tag.  Changing his calc to 

"data:text/html,
<html>
<body margin='0' style="border:'0'; background-color:rgb(" & 
Table::Red 
& "," & 
Table::Green 
& "," &
Table::Blue  
& ")">
</body>
</html>"

made it display properly.

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.