Advanced PowerBuilder

HomePrevious Lesson: Creating a New User Interface
Next Lesson: Arranging Sheets

Resizing the Controls Automatically

We can make w_product_master window more useful, by simply resizing the DataWindow controls whenever the user resizes the window. To do this, we have to add some code to the resize event of the w_product_master:

// Object: w_product_master
// Event: Resize

dw_query.x = 10
dw_query.y = 10
dw_query.Width = WorkSpaceWidth() - 20
dw_query.Height = WorkSpaceHeight() - 20

dw_product.x = dw_query.x
dw_product.y = dw_query.y
dw_product.Width = dw_query.Width
dw_product.Height = dw_query.Height

We are using the WorkSpaceWidth() and WorkSpaceHeight() functions to determine the width and height of the workspace and then to resize the controls, leaving a border of 10 units around the DataWindow controls.
HomePrevious Lesson: Creating a New User Interface
Next Lesson: Arranging Sheets