Mastering PowerBuilder

HomePrevious Lesson: Statusbar Service
Next Lesson: LUW (Logical Unit of Work) Service

Window Resizing Service

The window resize service resizes all the registered objects within a window whenever a window resizes. Like any other service, you need to turn on window resize service in all windows that you want to use.
// Object: w_product_master
// Event: pfc_PostOpen
this.of_SetResize(TRUE)

Then call couple of functions to set the original window size and the minimum window size.

Specifying the min size for the window using of_SetMinSize() doesn't prevent the user from resizing the window smaller than the specified size. PFC doesn't resize any registered objects within the window when the window size goes below the min size.
// Object: w_product_master
// Event: pfc_PostOpen
this.inv_resize.of_SetOrigSize(this.width, this.height)
this.inv_resize.of_SetMinSize(this.width, this.height)

Then register each object you want to resize. The following registers dw_product.
// Object: w_product_master
// Event: pfc_PostOpen
this.inv_resize.of_Register(dw_product, this.inv_resize.SCALE)
// OR
this.inv_resize.of_Register(dw_product, 'Scale')

The following is a list of resizing options declared in the pfc_n_cst_resize object. In the function calls, you can either use those constants or the value of the constant as shown in the above example.
Constant String FIXEDRIGHT =  'FixedToRight'
Constant String FIXEDBOTTOM = 'FixedToBottom'
Constant String FIXEDRIGHTBOTTOM = 'FixedToRight&Bottom'
Constant String SCALE = 'Scale'
Constant String SCALERIGHT = 'ScaleToRight'
Constant String SCALEBOTTOM = 'ScaleToBottom'
Constant String SCALERIGHTBOTTOM = 'ScaleToRight&Bottom'
Constant String FIXEDRIGHT_SCALEBOTTOM = 'FixedToRight&ScaleToBottom'
Constant String FIXEDBOTTOM_SCALERIGHT = 'FixedToBottom&ScaleToRight'

Remember that PFC uses the percentage method. If you originally painted the window with 10 PBU gap between each object, then the gap between each object may be higher when the window is maximized. This service does not resize objects that reside with in a DataWindow. You need to use the DataWindow resize service for that purpose. Registering user objects placed in a window doesn't work if you have a user object in a window.
HomePrevious Lesson: Statusbar Service
Next Lesson: LUW (Logical Unit of Work) Service