Jump to content

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

Recommended Posts

Posted

I have a set of 7 buttons - one for each day with an attached script.

 

If I click a button, I want its background to change color.

 

This works, but only when pressing it. It then goes back imediatly to previous appearance.

 

I want it to keep the new background color to help remember the user what he choose.

 

When he clicks any of the 6 other buttons, that button will then be the one with the new background color.

 

Do you need a script to do that?

 

Posted

What you are describing is Button State, which only works for one button.

 

Are you using Tabs, or trying to navigate between Table Occurrences?

 

Perhaps you can speed up this process by attaching a copy of your file.

Posted

See if this helps you.

 

Note the use of script parameters and just one script (not “scripts”), plus a global $$variable, Conditional Formatting and the Refresh Object step (new in FM 13).

SevenButtons_eos.fmp12.zip

Posted

Hi eos,

 

I was going to make a demo also, but wanted to understand better how these buttons were going to be implemented.

 

I noted that you grouped the buttons, and I’m not sure that the OP will know that they will need to ungroup them in order to drill down to see how these work.

 

Lee

Posted

Hi eos,

I noted that you grouped the buttons, and I’m not sure that the OP will know that they will need to ungroup them in order to drill down to see how these work.

 

Hi Lee, 

 

I wanted to make my life easier with the "Refresh Object" step.

 

OTOH, one could refresh the button corresponding to the old $$, and then the one for the new $$ … The best code is probably not only the one you never wrote (no bugs!), but also the one that comes to you 5 min. after you submitted the “final” version …  :ermm:

Posted

Why not just add the refresh?

TheScript
Set Variable [ $sp; Value:Get ( ScriptParameter ) ]
Set Variable [ $$buttonNumber; Value:$sp ]
Refresh Object [ Object Name: "buttonRow" ]
Set Variable [ $dayOfWeek; Value:Mod ( $sp ; 7 ) + 1 ]
#
#here would be what you original scripts are doing, now simply using the script parameter, so you only need one (1) script Show Custom Dialog [ Title: "You clicked button no. " & $sp; Message: List (
"Weekday is " & GetValue ( List ( "Monday" ; "Tuesday" ; "Wednesday" ; "Thursday" ; "Friday" ; "Saturday" ; "Sunday" ) ;
$sp ) ;
"Internal day of week is " & $dayOfWeek ;
); Default Button: “Gee”, Commit: “No” ]
Refresh Window
[ Flush cached join results; Flush cached external data ]
Posted

To EOS:

 

I adapted your script and it works fine.

 

However, I cannot click anywhere on the layout until the window it generates is closed.

 

How could the user navigate at will on the page and then close that Windows when is ready to?

Posted

sedekk –

 

just delete the “Show Custom Dialog” line; instead, you could add the steps from your original script(s) – using the script parameter passed from the button instead of hard-coded values. The variable assignments are just to show how you can convert a parameter to another value, should that be necessary.

Posted

Thank you,

 

I will try that solution.   This was very helpful.

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