It's not OnViewChange. It's OnLayoutSizeChange.
Ok so what would be the script to resize the layout, is it straight forward or would I need to incorporate some get (screen height/width) instructions.
The script does not resize the layout. The trigger detects the automatic layout size change that occurs when you rotate an iOS device. You can use the trigger to perform a script that changes layouts so that you have one layout for landscape orientation and one for portrait orientation.
When using this method, i create one layout where I've used the device stencils to place the rectangles for both portrait and landscape orientation on the same layout. The rectangle in upper left corner that is formed by the intersection of these two rectangles marks the portion of the layout that will not change when the device is rotated. I put the various layout objects that are most critical to the correct function of this layout inside that area.
Then I use Duplicate Layout to make a duplicate of this layout. I name the two layouts identically except for adding a "P" or "L" as a final word in the layout names. (Example: I might name one layout "Inventory List P" and the other "Inventory List L".) I then customize each layout so that one is optimized for landscape orientation--fitting all layout objects inside the horizontal rectangle and resizing the layout height and width to fit it, and the other is optimized for portrait orientation by fitting that layout to the vertical rectangle.
Then I set up the OnLayoutSizeChange trigger on both layouts to perform a script similar to this one:
If [ Get ( WindowContentWidth ) > 400 // Phone is horizontal ]
Go to Layout [Let ( L = Get ( LayoutName ) ; LeftWords ( L ; WordCount ( L ) - 1 ) & " L" )]
Go to Layout [ Let ( L = Get ( LayoutName ) ; LeftWords ( L ; WordCount ( L ) - 1 ) & " P" ) ]
The go to layout steps are using the "layout name by calculation" option.
This enables me to use the same script with each pair of orientation customized layouts that I add to my database.
Note: I only have an iPhone 4s. If I were designing for newer phones and iPads, I'd need a more sophisticated script that distinguishes between devices in order to correctly identify the current orientation and also to select the correct layout for that device.
Ok I think I can manage that, it means doubling up on all the Layouts and possibly thinking about some scripts that are designed to be run upon layout enter. I could use the same principle for the iPad as well to have 4 layouts per layout.
Multiple layouts to maintain are the biggest draw back to this approach. Another option uses auto-size anchors to slide and stretch layout objects to adjust the layout to the current orientation. Objects can be hidden behind tab controls or rectangles filled with the same color as the layout background and when the layout expands horizontally or vertically, the anchors slip the object out of hiding. And fields and portals can "stretch" to fit the screen. It can be especially nice to have a portal stretch vertically to show more portal rows in portrait than you see in landscape. (To make an object stretch, select both top and bottom or left and right anchors for the same object.)
This can make a layout that adapts to the current orientation without using two layouts, but It's a bit of a wash in terms of being easier to maintain than pairs of dedicated layouts as the resulting layout is often very complex in its design with numerous objects hidden from view at the time that you edit the layout. (And they can look really weird when you view the layout on a computer screen during testing and development. )