5 Replies Latest reply on Sep 18, 2012 2:46 AM by mrwatson-gbs

    Anyone found a way to get layoutWidth in FM12

    carterbrooks

      Layouts now have widths, but there doesn't seem to be either a "Get()" flag for LayoutWidth, or a Design Function that gives it to us.

      Seems like this would be a rather obvious thing, but I can't seem to find a calculation or function for it.

       

      (And, please, before you give me either of these solutions:

      - I can create an object on my layout and name it "layoutWidth" and get the bounds of that,

      - I can use ResizeToFit and then GetWindowWidth flags

      ... please don't.

      I'm not stumped on how I can do it, just where this function might be hiding if it is there.)

       

      Thanks,

       

      Carter

        • 1. Re: Anyone found a way to get layoutWidth in FM12
          thomas_staehli

          I was looking into this as well, but didn't find anything so far. This would be a really nice function to have...

          • 2. Re: Anyone found a way to get layoutWidth in FM12
            TimAnderson

            You could add an object that starts immediately outside the layout and get it's position....

             

            A little better than creating an object the full width and having to hide it in browse mode as it would never be visible

             

            Tim

            • 3. Re: Anyone found a way to get layoutWidth in FM12
              BruceHerbach

              There are two functions that may be of help.  Get ( WindowContentWidth ) and Get ( WindowContentHeight )

               

              The catch is they are dependant on the size of the window.  If you resize the window the value changes.  I think to get the Original intended width or height,  you would have to resize the window to fit first.

               

              HTH

              Bruce

              • 4. Re: Anyone found a way to get layoutWidth in FM12
                TimAnderson

                That would be the benefit of an object just to the right of the layout area. If you wanted the 'non expanding' width then anchor it left, otherwise anchor it to the right

                Tim

                • 5. Re: Anyone found a way to get layoutWidth in FM12
                  mrwatson-gbs

                  Here is a workaround until FMI give us a status function (@FMI: hint hint):

                   

                  You can measure the dynamic dimensions of your layout (i.e. stretched) by using a field on the layout and the design functions to "introspect":

                   

                  Bildschirmfoto 2012-09-18 um 11.35.20.png

                   

                  Many databases have a navigation bar at the top anyhow, so you can use that if it's there, otherwise you can place a hidden, empty global field on the layout.

                   

                  E.g.

                   

                  Create a field MyTable::LabelWidth (global Textfield) and place it on the layout across the full width of the layout with expansion to the left and right.

                   

                  The following Script "Get Dimensions" extracts the field dimensions and calculates the layout width (or body height)

                   

                  Set Variable[ $FieldInfo ; FieldBounds ( Get( FileName ) ; Get( LayoutName ) ; GetFieldName( MyTable::LayoutWidth ) ) ]

                  Set Variable[ $LayoutWidth ; MiddleWords( $FieldInfo ; 3 ; 1 ) - LeftWords( $FieldInfo ; 1 ) ]

                  #

                  # For test purposes: Display

                  Set Field[ MyTable::LayoutWidth ; "<-- " & $LayoutWidth & " -->" ]

                  #

                  Set Variable          $FieldInfo          FieldBounds ( Get( FileName ) ; Get( LayoutName ) ; GetFieldName( MyTable::BodyHeight ) )

                  Set Variable          $BodyHeight          MiddleWords( $FieldInfo ; 4 ; 1 ) - MiddleWords( $FieldInfo ; 2 ; 1 )

                  #

                  # For test purposes: Display

                  Set Field          MyTable::BodyHeight          "^¶|¶|¶¶" & $BodyHeight & "¶¶|¶|¶v"

                  #

                   

                  After changing the window size you can call the script.

                  The information is returned by functions, so you can also build it into fields or calculations or whatever, but be careful of refresh problems, if you wish to display the data.

                   

                  Hope this helps :-)

                   

                  Greetings from Hamburg

                   

                  Mr. Watson