Jump to content
Server Maintenance This Week. ×

Popover button behavior with script triggers


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

Recommended Posts

I have a pesky problem with trying to implement popovers to replace some older picker popups.

 

I have created a popover, and attached an OnObjectEnter script trigger and an OnObjectExit script trigger (to the popover itself, not the button).

 

The OnObjectEnter script sets some variables to prepare the popover for portal data selection.  This works fine.

 

The OnObjectExit script trigger clears the variables.  I have a Cancel button on the popover that executes Close Popover command, which triggers the OnObjectExit script trigger to clear variables.  This works fine.

 

The problem is when you click the popover button itself again.  I've noted the default behavior on the popover button is to toggle the popover on and off.  But for some reason, whenever I click this button to close the popover with the script triggers in place, it closes and then immediately opens again.  The OnObjectEnter script trigger fires for some reason, and I cannot figure out why.

 

I have read that the OnObjectExit executes before, and OnObjectExit executes after, but I can't figure out why the OnObjectEnter script trigger fires when the popover button is toggled to close the popover, or how to squelch this behavior, since there doesn't appear to be any way to detect the current state of the popover.

 

Hopefully this description makes sense.  Can anybody explain what's happening here, and how to fix it?  It's a minor annoyance, since the Cancel button on the popover works (and so does clicking on the layout outside of the popover), but it's one I'd like to address if possible.

 

Thanks for your time!

Link to comment
Share on other sites

Have the OnObjectExit trigger check on a flag $$, say $$EXIT; if it's not set, return a script result of False, which will cancel the exit and any clicks outside the panel, including the one on the popover button.

 

To actually allow leaving the popover in order to perform your Cancel, Save or other scripted actions, set the $$ to True (and don't forget to delete it when all is said and done, so the next invocation of the popup starts with the correct state, i.e. the variable not being defined).  

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Have the OnObjectExit trigger check on a flag $$, say $$EXIT; if it's not set, return a script result of False, which will cancel the exit and any clicks outside the panel, including the one on the popover button.

 

To actually allow leaving the popover in order to perform your Cancel, Save or other scripted actions, set the $$ to True (and don't forget to delete it when all is said and done, so the next invocation of the popup starts with the correct state, i.e. the variable not being defined).  

 

Two questions, why do you set the flag as a global variable and how do you delete it when done?

Link to comment
Share on other sites

Two questions, why do you set the flag as a global variable

 

Because it needs to be preserved between the two events that trigger your script(s) (OnEnter, initialize, OnExit, query (then delete)).

 

and how do you delete it when done?

 

In the exit script (or exit part when using a single script to handle the entire process).

Link to comment
Share on other sites

In the exit script (or exit part when using a single script to handle the entire process).

 

Sorry eos, I understand now. Thanks. What I did not understand when I made my post was how to clear a global variable. Now I see that all you need to do is set it to nothing (Set $$MyGlobal to "").

Link to comment
Share on other sites

Sorry eos

 

Sorry for what? :smile: Anyway, I thought your question referred to the timing, not the mechanics.

 

Now I see that all you need to do is set it to nothing (Set $$MyGlobal to "").

 

Right; when you do that, it's not even empty, it's undeclared.

  • Like 1
Link to comment
Share on other sites

Sorry for what? :smile: Anyway, I thought your question referred to the timing, not the mechanics.

 

 

Right; when you do that, it's not even empty, it's undeclared.

 

Oh, this is good information.  I was wondering how global variables got "deleted."  So, when a global variable is no longer needed, is it best practice to set it to "" so that the variable is not taking up any memory?

Link to comment
Share on other sites

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