{"id":1324,"date":"2012-05-23T17:16:38","date_gmt":"2012-05-23T22:16:38","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=1324"},"modified":"2021-03-11T11:25:49","modified_gmt":"2021-03-11T16:25:49","slug":"powerbuilder-resizing-a-response-window-or-user-object","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-resizing-a-response-window-or-user-object\/","title":{"rendered":"PowerBuilder &#8211; Resizing a Response Window or User Object"},"content":{"rendered":"<p>Here is a technique you can use to resize a response window or userobject as needed. It makes use of the GetWindowLong and SetWindowLong Windows API methods. The oldest reference I found to this is from <a href=\"http:\/\/eric.aling.tripod.com\/\" target=\"_blank\" rel=\"noopener\">Eric Aling back in 2000<\/a>. In a nutshell, you are changing the border around the object to one which Windows allows to be resized. What&#8217;s even nicer about this is the standard resize events are triggered so you can reposition\/change objects within the window as well (PFC resize service for example). From Eric&#8217;s original post:<\/p>\n<pre>&quot;The Get function retrieves the complete defenition of the window in \na big long variable. All the bits in this long value describe the window. \nSo there are bits for the type of border (which indicates if a window is \nresizable), menu, colors etc.etc. We can modify this long value, altering \nthe design of the window. Using the SetWindowLong() we update the window with \nour specific modifications.&quot;<\/pre>\n<p>I used this in ancestor code of a userobject I use to create visible panels within the main window.<\/p>\n<pre name=\"code\" class=\"VB\">\/\/ Unicode declarations, used &#039;A&#039; for ANSI\nfunction long GetWindowLongW (long hWindow, integer nIndex) Library &quot;user32.dll&quot;\nfunction long SetWindowLongW (long hWindow, integer nIndex, long dwNewLong) library &quot;user32.dll&quot;\n\n\/\/ code in my post constructor event\nn_cst_numerical lnv_num \/\/ PFC numeric service\nlong\t\tll_Styles\nboolean\t\tlb_Control\n\nconstant long\tWS_THICKFRAME = 262144\nconstant long\tWS_SYSMENU = 524288\n\nll_styles = GetWindowLongw(handle(THIS), -16)\nif ll_styles &lt;&gt; 0 then\n\n\tll_styles = lnv_num.of_BitWiseOr(ll_styles, WS_THICKFRAME)\n\/\/ don&#039;t need control menu but leave this for reference \n\/\/\tif ab_Control then \n\/\/\t\tll_styles = lnv_num.of_BitWiseOr(ll_styles, WS_SYSMENU)\n\/\/\tend if\n\n\tSetWindowLongW(handle(THIS), -16, ll_styles)\nend if<\/pre>\n<p>At first my UO cannot be resized.<\/p>\n<p><a href=\"http:\/\/anvil-of-time.com\/wordpress\/wp-content\/uploads\/2012\/05\/resizeUO1.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1325 size-full\" title=\"resizeUO1\" src=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2012\/05\/resizeUO1.png\" alt=\"\" width=\"115\" height=\"120\" \/><\/a><\/p>\n<p>Now it can!<\/p>\n<p><a href=\"http:\/\/anvil-of-time.com\/wordpress\/wp-content\/uploads\/2012\/05\/resizeUO2.png\"><img loading=\"lazy\" class=\"aligncenter wp-image-1326 size-full\" title=\"resizeUO2\" src=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2012\/05\/resizeUO2.png\" alt=\"\" width=\"109\" height=\"120\" \/><\/a><\/p>\n<p>I&#8217;ve seen other references to these API calls for manipulating windows for other things but I have not investigated further.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a technique you can use to resize a response window or userobject as needed. It makes use of the GetWindowLong and SetWindowLong Windows API methods. The oldest reference I found to this is from Eric Aling back in 2000. In a nutshell, you are changing the border around the object to one which&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,10],"tags":[33,12,16,42],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1324"}],"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=1324"}],"version-history":[{"count":7,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1324\/revisions"}],"predecessor-version":[{"id":2032,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/1324\/revisions\/2032"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=1324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=1324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=1324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}