Window for iPad & iPhone

Generally speaking, you can create different sets of windows specific to iPad and iPhone, or create one set of windows for both iPad and iPhone. Our recommendation is creating two sets of windows: one for iPad, and the other for iPhone, though the window number doubles, it is easier to control for developers.

Different sets of windows

As iPad and iPhone have very different screen sizes, our recommendation is designing windows for iPad and iPhone respectively. For example, you can design a window w_iPhone for iPhone, and a window w_iPad for iPad, and open the window according to the device type; you can call the interface of_getDeviceType to get the device type at runtime.

Even for the same device type, as screen size changes greatly when orientation changes, we recommend designing windows for Landscape and Portrait respectively. For example, you can design several windows such as w_iPhone_Landscape, w_iPhone_Portrait, w_iPad_Landscape, and w_iPad_Portrait, and you can call the interface of_getOrientation to get the device orientation at runtime.

Same set of windows

Instead of designing two sets of windows and opening the window according to the device type at runtime, you may want to create just one set of windows for all devices and adjust the window and control size at runtime via the Resize event. However, this would be complicated in some cases and would require you to consider every single situation that causes window to resize, including:

  1. Resize caused by the user manually resizing or maximizing a window at runtime if the window is set to support resize;

  2. Resize triggered by script. For example, in business logic, there may be situations when a condition is met, the window size needs to change accordingly.

  3. Resize occurred when window is created. This happens only one time. Unlike PC where window size is fixed, there could be different window sizes on mobile devices, even if it is the same PowerBuilder window. Different height and width could be passed to the resize event, because the device to run the application may be an iPhone, or an iPad, in landscape or portrait mode.

  4. Resize triggered by orientation changes. Unlike PC, mobile devices support orientation changes between landscape and portrait, and the size differs greatly.

All these different situations add up the complexity of UI adjustment. Take a simple example here, you may have a request that the window should not respond to the Resize event or the layout of controls should not change whenever the user resizes a window, but the window should support orientation changes between landscape and portrait. But apparently, there is no way to exactly figure out under what situation the Resize event is triggered and then process the event accordingly.

To try to reduce the complexity somewhat, we provide the interface of_getOrientation to determine whether the current device is in landscape or portrait view; and we also provide the orientation change event which will be triggered when the device orientation changes.