March 18, 201411 yr 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?
March 18, 201411 yr 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.
March 18, 201411 yr 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
March 18, 201411 yr 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
March 18, 201411 yr 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 …
March 18, 201411 yr 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 ]
March 18, 201411 yr Author 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?
March 18, 201411 yr 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.
Create an account or sign in to comment