Jump to content

Hidden Popover Open/Close


Recommended Posts

Hello and thank you peeking at my question... I can not seem to get my scripts to behave in a way that is expected, driving me batty!

OBJECTIVE :: Fix Popover Open button so that when clicked popover opens, and when clicked again the popover closes.

CURRENT ERROR :: At the moment when Popover button is clicked the popover opens, and then just reopens when clicked again, which is not the desired behavior.

NOTES :: To help illustrate my issue, I've attached some files.
THANK YOU kindly for your time and help! 🤠

sample_popover_open_close.png

sample_popover_open_close.fmp12

I've been able to get the highlight open/close to work outside of this demo file. But NOT when I have a "clear highlight" script trigger attached popover. I need a "clear highlight" script trigger for when User clicks anywhere other then the button and closes the popover. Record should only highlight when popover is open.

Link to post
Share on other sites

Remove the script trigger from the popover, and instead add this to the top of the popover open script:

If[ FOODS::__pk_FOODS = FOODS::highlightGlobal ]
  Set Field[ FOODS::highlightGlobal ; "" ]
  Exit Script
End If

 

Link to post
Share on other sites

Gottcha, Fitch!... in the working file outside this demo, I'm using the if [], and that works fine as long as the User presses the script button. But User is highly likely not to only click the button, and more likely to just randomly click elsewhere on the layout... which will cause the popover to close while leaving a highlighted state active.

I've updated the file and screenshot of script:

 

 

sample_popover_open_close_2.fmp12

Screen Shot 2020-10-18 at 7.49.01 PM.png

Edited by Dr. Evil
Link to post
Share on other sites
On 10/18/2020 at 7:50 PM, Dr. Evil said:

randomly click elsewhere on the layout... which will cause the popover to close while leaving a highlighted state active.

You almost had it ... since you want to clear the global value (that controls the conditional formatting), you must use OOExit script trigger on the popover.  Attached is how I'd modify your example.  Of course there are other ways to approach the problem ... there are always alternatives. 😁

 

sample_popover_open_close_MOD.fmp12

Edited by LaRetta
Link to post
Share on other sites

☺️ Thank you LaRetta!.. this functions, but still when User clicks say, the Burrito item, popup appears, if the User clicks the burrito again, it should close, but at the moment it pops back open. I'm hoping for the effect of it collapsing open when clicks, and collapse down with clicked again. 

This is normal behavior for a popover to collapse out when click, and collapse down when clicked again. BUT since it is being activated via script, the natural behavior has changed.

I apologize for my awkward type up description, i often wish some in-person work could be done.

Link to post
Share on other sites

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.