{"id":431,"date":"2010-10-05T20:30:49","date_gmt":"2010-10-06T01:30:49","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=431"},"modified":"2021-03-09T13:21:40","modified_gmt":"2021-03-09T18:21:40","slug":"powerbuilder-window-object-resizer-bar","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-window-object-resizer-bar\/","title":{"rendered":"PowerBuilder &#8211; Window object resizer bar"},"content":{"rendered":"<p>Here is a fairly simple technique to allow for the resizing of objects on a window. Its best use is to provide a &#8216;splitbar&#8217; 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.<\/p>\n<p>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.<\/p>\n<p>Example:<br \/>\n<a href=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-start.png\"><img loading=\"lazy\" class=\"wp-image-433 size-medium aligncenter\" title=\"Resizer bar example\" src=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-start-300x235.png\" alt=\"\" width=\"300\" height=\"235\" srcset=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-start-300x235.png 300w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-start-150x117.png 150w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-start.png 327w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>First define an instance variable on the window.<\/p>\n<p>Define an event on the window mapped to pbm_lbuttondown.<\/p>\n<pre name=\"code\" class=\"VB\">\/\/we_lbuttondown -  using pbm_lbuttondown\n\nis_clicked_obj = &#039;&#039;\n\nif ypos &gt; r_1.y and ypos &lt; (r_1.y + r_1.height) and &amp;\n   xpos &gt; r_1.x and xpos &lt; (r_1.x + r_1.width) then\n\tis_clicked_obj = &#039;r_1&#039;\n\tdw_1.enabled = false\n\tdw_2.enabled = false\nend if<\/pre>\n<p>Now in the mousemove event on the window<\/p>\n<pre name=\"code\" class=\"VB\">\/\/mousemove on window\nlong ll_y_offset\nif keydown(KeyLeftButton!) then\n\t\/\/ determine which sizing object \n\tchoose case is_clicked_obj\n\t\tcase &#039;r_1&#039;\n\t\t\tsetpointer(SizeNS!)\n\t\t\tll_y_offset = ((dw_1.height + dw_1.y) - ypos)\n\t\t\tdw_1.height = dw_1.height - ll_y_offset\n\t\t\tdw_2.y = dw_2.y - ll_y_offset\n\t\t\tdw_2.height = dw_2.height + ll_y_offset\n\t\t\tr_1.y = r_1.y - ll_y_offset\n\t\tcase else\n\t\t\tdw_1.enabled = TRUE\n\t\t\tdw_2.enabled = TRUE\n\n\tend choose\nend if<\/pre>\n<p>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.<\/p>\n<p><a href=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-move.png\"><img loading=\"lazy\" class=\"wp-image-434 size-medium aligncenter\" title=\"Resizer bar Move\" src=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-move-300x245.png\" alt=\"\" width=\"300\" height=\"245\" srcset=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-move-300x245.png 300w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-move-150x122.png 150w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2010\/10\/resizer-bar-move.png 322w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a fairly simple technique to allow for the resizing of objects on a window. Its best use is to provide a &#8216;splitbar&#8217; 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&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,10],"tags":[12,16],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/431"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=431"}],"version-history":[{"count":8,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/431\/revisions"}],"predecessor-version":[{"id":1857,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/431\/revisions\/1857"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}