3 Replies Latest reply on Sep 14, 2014 8:44 AM by philmodjunk

    Scale Container to Image?



      Scale Container to Image?


      I want to format a container so it will scale, dynamically, up or down to fit the image it contains rather than the other way round. In FMPA-13 is there a way to do that with Conditional Formatting or any other technique?

        • 1. Re: Scale Container to Image?

          The only method that comes to mind is to use a separate floating window. You use a layout for the window that consists only of the container field and set all for auto-size anchors. Then you size the window to fit the pixel dimensions of the image.

          And to get the pixel dimensions of an image, inserting it into a container field using Insert Picture with the "store a reference" option specified, the first row of text you get from the container field using GetAsText ( ContainerField ) will  a Pixel X Pixel resolution for the image file.

          And in FileMaker 13, it's easier as you can use the Getcontainerattribute function to get the pixel width and height of your image in the container field.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Scale Container to Image?


            Is what you are describing done in Format/Conditional? 

            I kinda see how that might be made to work but, I want it to be within an existing layout so, the floating window kinda defeats my purpose.

            I guess I was hoping for a secret "Reduce or enlarge container to fit image" option. 

            • 3. Re: Scale Container to Image?

              No it would not be done with conditional formatting. You get the image in its own window floating in front of the main window. A script using new window opens the window to dimensions calculated from the pixel dimensions of your image.

              (I've done something simpler where the window opens the same size every time, but the user can drag borders of the window to resize it to larger or smaller sizes.)

              The only method I can think of that is inside the layout, is to layer a series of differently sized copies of the same container field on top of each other each with a "hide object when" property that opens the copy that's the closest fit to the image. That's very crude and does not recover the unused space created with smaller copies of the field (except when printing or previewing where you can set up objects on your layout to "slide and resize enclosing part".