3 Replies Latest reply on Apr 12, 2016 9:49 AM by realgrouchy

    Hide object when script running only works one way



      Hide object when script running only works one way


      FileMaker Pro



      Operating system version


      Description of the issue

      In my FMP13 database, I have a script to select and print members with a specified condition, and I want to give my users the ability to review what records are selected before printing them. To this end, I have the script pause and they can change the condition for any member(s) that they do not want to print, then they can press continue.

      However, the layout on which they do this also has the button that is used to trigger the print script. I'd like to hide this button (among other things) while the script is paused.

      I can do this by adding "Get ( ScriptName ) > 0" to each of the objects I want to hide, but they all have different hide conditions and I'd have to apply it to every current object and every new object going forward.

      Instead I'd like to just put a big rectangle over the whole area that only hides in the opposite scenario, i.e. "Get ( ScriptName ) = " or "not ( Get ( ScriptName ) > 0 )"

      Steps to reproduce the problem

      1. Create an opaque rectangle with hide condition of either "Get ( ScriptName ) = " or "not ( Get ( ScriptName ) > 0 )"
      2. Create a script with a pause
      3. Create a button to trigger the script created in step (2), arrange that position to behind the object created in step (1).
      4. Save layout
      5. Click the button.

      Expected result

      Expected Result: The object created in step (1) should not appear after saving the layout, but should appear after clicking the button and/or while the script is paused.

      Also, if I click "Cancel" to cancel a paused script, any objects hidden with "Get ( ScriptName ) > 0" don't reappear.

      Actual result

      Actual Result: The object does not appear at all, at any time.


      Only workaround available is to find every object I want to hide and add "Get ( ScriptName ) > 0" to its existing hide conditions. Aside from being cumbersome (since many of these are buttons layered on top of each other that appear based on various conditions), I fear I will forget to do so if I create new objects, and a user in a paused script will engage in unexpected behaviour.

        • 1. Re: Hide object when script running only works one way

          IsEmpty ( Get ( ScriptName ) )

          would seem the more logical expression to hide a layout object when a script is not running or paused. But you often need to use Refresh Object when a script changes things in a way that affects object visibility.

          That definitely seems to be the case here as my tests show that if I put a Refresh object before the pause and after the pause, this works.

          But canceling the paused script will not update the object's visibility.

          • 2. Re: Hide object when script running only works one way

            Aw crap, that was sloppy of me. I was using a grouped object whose member objects had overriding hide parameters. No wonder it wasn't working! Thanks.

            - RG>

            • 3. Re: Hide object when script running only works one way

              (I was trying to fix a problem with my hidden objects and searching for a solution and came to this thread... it took me a while to realize this is a thread that I started, regarding the very objects I'm having trouble with!)


              My objects aren't reappearing when the script ends, and I can't use a script to refresh the object because the hide parameter is true while that script would be running! *facepalm*


              I'll have to change all my objects to instead work off a script parameter (e.g. $HideLayoutObjects) of of which the hidden objects can work.


              Now to go find and change all those objects...


              - RG>