8 Replies Latest reply on Mar 24, 2009 2:54 AM by abitech

    Adding a button to open a pop-up image



      Adding a button to open a pop-up image


      One more question: 


      Is it possibile to add a button to records that opens an image as a pop up when clicked?


      If so, where do I store the pictures - in a folder in my pc and FileMaker links to them, or are they embedded in the .fp7 file?

        • 1. Re: Adding a button to open a pop-up image

          Hi abitech


          Either option for storing the picture in the container or as a reference will work fine, just as a reference will mean a smaller database file size and would be my recommendation, you just need to make sure to select Insert Picture and not Insert File, as this will then allow you to display the picture in the container.


          To get the picture to open in a pop-up window you need to first create a layout to display the contain in the required size. Then you need to write a script taht will open a new window to teh required size and then go to your new layout, it might look something like this:


          New Window [ Name: "Picture Name"; Height: 600; Width: 400; Top: 25; Left: 25 ] 
          Show/Hide Status Area [ Lock; Hide ] 
          Go to Layout [ “Paragraphs” (Paragraphs) ]  


          And you may also want to place a close button on your new layout that simply calls the script step Close Window [ CurrentWindow ]


          And job done. 


          If you have pics that are portrait and some landscape and you mark this in some way in the record, you could change the window size, in the New Window script step, based on that field and setup your container to use anchors to all sides and then the window will determine the size and shape of the image displayed, saving you having to build one layout for Portrait and one for landscape.


          I hope this helps.

          • 2. Re: Adding a button to open a pop-up image
               Thanks, does it mean that "insert picture" links it as a reference while "insert file" includes the file in the FileMaker file?
            • 3. Re: Adding a button to open a pop-up image

              No worries abitech,


              The different between the two is simply how FileMaker presents the result for you.


              So when you use Insert Picture, FileMaker will display the content of that container field as an image, resizing the picture to the container.


              However using Insert File, you will be presented with simply the file icon, even a .JPG will show as an icon and not the image itself.


              Reference or stored is optional on both and it simply determines the ultimate location of the file in the container.


              I hope this clears it up for you.


              More info can be found on the FileMaker website: http://www.filemaker.com/help/html/add_view_data.4.32.html#1030242

              • 4. Re: Adding a button to open a pop-up image

                The explanation was very helpful. Now, without right-clicking on the container, I need to create another button that opens a directory where the images are stored, in order to insert the picture that will be viewed as a pop-up.


                I tried to make a script for the button with "insert picture", but it doesn't work. "insert file" would work but it doesn't display the photo in the pop up window. Then i tried "insert picture" and specifying the source folder, but it only lets me pick the location of a single file. How do I do it?

                • 5. Re: Adding a button to open a pop-up image

                  Hi abitech


                  The problem may be that the Insert Picture script step is not pointing to your container field, try including a Go To Field step first, so it will look like this:


                  Go To Field [ TABLE::ImageContainer ] 
                  Insert Picture []


                  Let me know if this does the trick.

                  • 6. Re: Adding a button to open a pop-up image
                       Hi, it works now, there is only one thing I'm missing. When I insert the image, can I force it to pick the file from a certain folder in the computer or server?
                    • 7. Re: Adding a button to open a pop-up image

                      If you know the name of the file you want to add you could set the name in a Variable and insert the file with no need for the user to select it.


                      However if you want it the open the Select File dialog to a specific folder I don't think this can be done as it is controlled by the OS.

                      • 8. Re: Adding a button to open a pop-up image
                           I see, thanks a lot for your help.