title Resize example dialog CREATE,Resize example,-1,0,240,160,RESIZABLE dialog ADD,LIST,LIST1,54,10,220,94 dialog ADD,EDIT,EDIT1,24,10,150,19 dialog ADD,BUTTON,BUTTON1,22,166,64,24,BUTTON1 dialog ADD,STATUS,STATUS1 dialog SHOW :evloop wait event goto @event() :RESIZE rem checks the size of the dialog, if its smaller then the rem initial size we set then the dialog is resized to the rem smallest size we allow (default size) if @not(@greater(@dlgpos(,W),239)) @not(@greater(@dlgpos(,H),159)) dialog setpos,,,,240,160 end rem now resizes all dialog controls, basically only need to rem set the width and height, you do this by taking the rem width/height of the dialog and then setting that as the size rem of the control, but you want a border, so subtract a few extra rem pixels so a border is placed between the width/height of rem the dialog and the control. rem here we just need to set the width and height of the listbox rem so what we do is set default values for top and left, then rem we get the WIDTH of the dialog, and then subtract 20 from it rem we do this so there is a 20 pixel border between the border rem edge and the listbox. For the height we do the same but take rem the HEIGHT of the dialog, remember also you need to compensate rem for the TITLEBAR height and STATUSBAR height. dialog setpos,LIST1,54,10,@fsub(@dlgpos(,W),20),@fsub(@dlgpos(,H),86) rem here we just need to set the width of the edit so what we do rem is just get the WIDTH of the dialog and then subtract 90 from rem it. We need to subtract 90 because the difference between the rem width of the edit and the dialog was 90, which rem is the border between the edit and button1. dialog setpos,EDIT1,24,10,@fsub(@dlgpos(,W),90),19 rem here we just need to set the left position of the button, so rem what we will do is just get the width of the edit1 and add rem 16 pixels. We do this because originally the default width rem between the EDIT1 and the BUTTON1 is 16 pixels. dialog setpos,BUTTON1,22,@fadd(@dlgpos(EDIT1,W),16),64,24 goto evloop :BUTTON1BUTTON goto evloop :CLOSE exit