Using MOP views for custom visual user objects

The User Object painter includes a MOPView Manager that lets you assign runtime layouts which change automatically when an application user changes the orientation of a handheld device or emulator. You can use the View>Runtime MOP Views>MOPViewManager menu item in the User Object or DataWindow painter to create multiple views for a custom visual user object that have the same orientations available to PocketBuilder windows.

For more information on the available views, see “Multiple Orientation Painter for windows”.

When you open a window containing a custom visual user object at runtime, PocketBuilder automatically selects the view of the user object that correlates with the current orientation of the device or emulator. If you do not create a specific view for the selected orientation, the last view saved in the painter is displayed at runtime. In this case, the custom user object does not necessarily display with optimal size and position for the user-selected orientation.

Property specificity

For a user object with multiple views, the position (x and y) and dimension (width and height) properties of the user object and any visual controls on the user object are view-specific. All other properties of the user object and its controls apply to all of the views defined for the user object.

The source code in the PKL file includes only the last position and dimension properties saved in the painter for the user object and the controls on the user object. Therefore, when you export a user object with MOP views, the MOP views are not included in the exported code. The exported code contains only the most recent position and dimension properties from the original user object.

However, when you copy or inherit from a user object, the copied or inherited user object retains all the MOP views set in the original user object. You can also move a user object from one PKL to another without losing its MOP views.