September 5, 200718 yr I want to create a toggle button in FM. The button on the first click should just change color and if the user does not click a second time within say 2 seconds, the button returns to its original state. Would using a repeating container field with 2 repetitions to hold 2 images showing the state of the button work? Click 1 sets the flag to 1 set the repeating field to show the second image if click 2 occurs within 2 seconds, set flag to 0 execute a script else set flag to 0 end if The trouble is how do I time the clicks? Is there a builtin function that can time the clicks? Should I use a timestamp for each click and calculate the difference to time the click? Thanks in advance for any help
September 5, 200718 yr A timestamp seems like the way to go. You could have the click set a modification time field or carry a script parameter of the current time-of-click and compare it to a variable that stores the last click time... Regards, Don
September 5, 200718 yr Thinking a bit more though, you're going to have trouble returning the color to the if there is no second click. There would have to be some event to trigger a screen refresh... Are you going to lock the user into a loop so you can keep an eye on the time and update the button image on each cycle? Regards, Don
September 12, 200718 yr You could use a webviewer with a javascript to fade the button back to its original color.
September 16, 200718 yr Author How 'bout using an external applescript to track the time elapsed and then Applescript GUI scripting to run a second script to set the state of the button? That way the user would not be locked into a loop? Also has anyone tried the zipp script for this problem? Thanks for all the posts
September 16, 200718 yr I thought there was a request here for 'revert, unless confirmed within 2 seconds' or something like that? Seems very similar to: http://www.fmforums.com/forum/showtopic.php?tid/176521/
September 17, 200718 yr Author Absolutely ! the original request is for revert in 2 seconds if not confirmed. Was hoping to allow users make minimum mouse moves during data entry thus avoiding irritating dialogs like "Are you really sure you want to confirm?"
September 17, 200718 yr I was just thinking does it need to be so complex. Anyway after a little thought it was actually really simple. Attached... best stuart button_2.fp7.zip
September 17, 200718 yr Ps as you are using version 9 i would also use conditional formatting but as i am not i can not :
Create an account or sign in to comment