8 Replies Latest reply on Dec 7, 2009 10:28 AM by philmodjunk

    Close a pop up window

    Stephen

      Title

      Close a pop up window

      Post

      Hello, I have an application that uses a pop up window to allow a user to add notes to a record. I have it set up so that the pop up window closes when you click a "Close" button. However, I'd like for the window to close automatically if the user clicks anywhere outside the pop up window. Is there a way to do this?

       

      I'm using FMP Advanced v.10

       

      Thanks.

        • 1. Re: Close a pop up window
          philmodjunk
            

          Stephen wrote:

          Hello, I have an application that uses a pop up window to allow a user to add notes to a record. I have it set up so that the pop up window closes when you click a "Close" button. However, I'd like for the window to close automatically if the user clicks anywhere outside the pop up window. Is there a way to do this?

           

          I'm using FMP Advanced v.10

           

          Thanks.


           

          Set each button to perform a script. Put Close Window[CurrentWindow] in each such script.

           

          Also, do you have a way to keep the user from "losing" the window by clicking on the larger window visible behind it?

           

          There are ways to do this also.


          • 2. Re: Close a pop up window
            Stephen
              

            Hello, thanks for your reply. First I'd like to know how to keep a user from covering a small window by clicking on a larger window.

             

            Thanks.

            • 3. Re: Close a pop up window
              marcusedward
                

              To keep a small popup window from getting covered by a larger background window you need to create a script that opens the popup windown and pauses until the user has finished with the popup.  

               

              I'm guessing you already have a script to open your popup.  You need to add the command "allow user abort" with a setting of off (this line can appear after any variable you need to capture).  

               

              Then at the end of the script add the "pause" command set to indefinitely and a last line that is "close window" (for this step I alwasy call out the name of the popup window rather than using the "current window" setting).

               

              Last you need to add a button to your popup set to resume script.

               

              Hope this helps,

               

              Marcus 

              • 4. Re: Close a pop up window
                philmodjunk
                  

                I'd really like to set a window property as "Modal" like I can in MS Access. Guess I should make that a feature request.

                 

                Since we can't, we can approximate the results with the following script steps

                 

                New Window (This is were you open your pop up and specify name, size and location)

                Show/Hide status area [Lock, Hide]

                Allow User Abort [Off]

                Pause/Resume Script[Indefinately]

                Close Window [current window] 

                 

                Allow user abort[off] keeps the user from using the Esc key to terminate the script.

                Pause/Resume keeps them from covering the pop up window.

                 

                Any buttons on the pop up should include

                Allow User Abort [On]

                Close Window ["Pop Up Window Name"]

                 

                as part of their script to return things to normal.

                 

                • 5. Re: Close a pop up window
                  Stephen
                    

                  Thank you all for your advice.

                   

                  As an aside, do you know if there is a way to use a script trigger to close a pop up window if, say, you click outside the pop up window?

                   

                  Stephen

                  • 6. Re: Close a pop up window
                    philmodjunk
                      

                    Stephen wrote:

                    Thank you all for your advice.

                     

                    As an aside, do you know if there is a way to use a script trigger to close a pop up window if, say, you click outside the pop up window?

                     

                    Stephen


                    When I first downloaded, FMP 10, I tried that. The paused script approach is much simpler.

                     

                    You basically have to set up a trigger or triggers on your underlying window that turns your entire layout into a giant button. There are Layout triggers that might do that depending on what layout view you have (Is it a list, form or table?) and whether it refers to the same table as your pop up window.

                     

                    Also, what you describe is atypical window behavior. In typical computer Graphic User Interface's, that action is not what users will expect and there's a small chance it might confuse your users when the windows closes on them.


                    • 7. Re: Close a pop up window
                      Musashi
                        

                      I have a button on each layout to close the windows.

                       

                      Is there a way to check if the widows is the last window open before it closes. If there is only one window open and they click on the close button the window will not close.

                       

                      Thanks

                       

                       

                      • 8. Re: Close a pop up window
                        philmodjunk
                          

                        There is a function called WindowNames that will return a list of all open Filemaker Windows. You can use it to test to see if the window being closed is the last window open.

                         

                        If [ Get (WindowName) = WindowNames /* current window is last window open */ ]