PowerBuilder – Window object resizer bar
Here is a fairly simple technique to allow for the resizing of objects on a window. Its best use is to provide a ‘splitbar’ type of control to dynamically shrink and enlarge the amount of space on a window a pair of datawindow objects occupy. If you really want to get fancy you will save the changed sizes as part of a user customization routine.
The sample window has two datawindows positioned on the top an bottom portion of the window with a rectangle object sitting in the area between them.
First define an instance variable on the window.
Define an event on the window mapped to pbm_lbuttondown.
//we_lbuttondown - using pbm_lbuttondown is_clicked_obj = '' if ypos > r_1.y and ypos < (r_1.y + r_1.height) and & xpos > r_1.x and xpos < (r_1.x + r_1.width) then is_clicked_obj = 'r_1' dw_1.enabled = false dw_2.enabled = false end if
Now in the mousemove event on the window
//mousemove on window long ll_y_offset if keydown(KeyLeftButton!) then // determine which sizing object choose case is_clicked_obj case 'r_1' setpointer(SizeNS!) ll_y_offset = ((dw_1.height + dw_1.y) - ypos) dw_1.height = dw_1.height - ll_y_offset dw_2.y = dw_2.y - ll_y_offset dw_2.height = dw_2.height + ll_y_offset r_1.y = r_1.y - ll_y_offset case else dw_1.enabled = TRUE dw_2.enabled = TRUE end choose end if
Now when the user left clicks and holds on the rectangle they are able to move it up and down with a corresponding resizing of the two datawindows.