[bb] Set Client WidthHeight by Blaine [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : Set Client WidthHeight
Author : Blaine
Posted : 1+ years ago

Description : Two new functions, SetClientWidth() and SetClientHeight(), for Blitz+.  Parameters are the window to modify, followed by the new width/height.  Use to modify the client area of a window without using the 'client coordinates' flag.  Note that the following limitations apply:
>These functions cannot make the window any smaller than the system allows.
>Since the functions base the new dimesions for the window off of the window's old dimensions, the old client area must be at least 1x1 or it will not work.


Code :
Code (blitzbasic) Select
Function SetClientWidth(win,width)
SetGadgetShape win,GadgetX(win),GadgetY(win),GadgetWidth(win)+(width-ClientWidth(win)),GadgetHeight(win)
End Function

Function SetClientHeight(win,height)
SetGadgetShape win,GadgetX(win),GadgetY(win),GadgetWidth(win),GadgetHeight(win)+(height-ClientHeight(win))
End Function


Comments :


TAS(Posted 1+ years ago)

 I would only use SetGadgetshape before adding any child objects or after using SetGadgetlayout to lock down every child object edge or you are probably not going to like the results.