Page 1 of 1

formwidth not working correct

PostPosted: Sun Feb 13, 2011 11:52 am
by Boudewijn
When resizing a form the formwidth stops adjusting itself when the form becomes smaller (in runtime) than the original design.
eg, I create a form with a width of 500.
On the form I have a textbox

in the form resize event I have some code like:
Code: Select all
forms["testform"].elements["lblFrmWidth"].text = "form: " + forms.testform.controller.getFormWidth()

//preferred code would be this.lblfrmWidth.text = ...
:D

the label shows the formwidth, unless the form is smaller than the original design.
EXTENDING the form beyond its original width gives the correct values.
I guess that is an omission.

Re: formwidth not working correct

PostPosted: Sun Feb 13, 2011 11:59 am
by Boudewijn
Correction, the textbox is not a textbox but a label (duuuhhh) :)

Re: formwidth not working correct

PostPosted: Sun Feb 13, 2011 12:38 pm
by ROCLASI
Hi Boudewijn,

A form will only grow when you resize a window/tabpanel. When you make the window/tabpanel smaller than the original size of the form at design time then you end up with scrollbars (unless you disabled those on the form).
If you don't want that then you have 2 options:
1) you make the form really small at design time
2) you add an onResize() event where you dynamically adjust the size of the form using the SolutionModel.

Hope this helps.

Re: formwidth not working correct

PostPosted: Sun Feb 13, 2011 11:32 pm
by Boudewijn
All in all, it does NOT show the correct size. and resizing means exactly that. the form is resized, no matter whether the form is bigger or smaller than its designed width.
so it IS an omission.

BL

Re: formwidth not working correct

PostPosted: Sun Feb 13, 2011 11:54 pm
by ROCLASI
Hi Boudewijn,

When you resize your window the form shrinks up to the size of the size you designed it for, after this the window will show a scrollbar (since the form isn't getting smaller). So it's showing the correct size alright.
The only thing is that you expect that the form will resize to a smaller size than you designed it at.
Consider the width of the form at design time the minimum width of the form. It will never (automatically) get smaller than that.

Hope this helps.

Re: formwidth not working correct

PostPosted: Mon Feb 14, 2011 12:09 am
by Boudewijn
Seems like we will never agree on this. formwidth should show just that. the form's width, because that is what the name of the property says "form width. no matter what it was designed for first. so even if the form, @ runtime, is made smaller than its original design "formwidth" shoul;d show the actual width, and not the design time width. that is of no matter at all.

Re: formwidth not working correct

PostPosted: Mon Feb 14, 2011 11:25 am
by pbakker
Boudewijn,

Robert is 100% correct: the form width is reported 100% correct, because the form is NEVER going to become smaller as you designed it, it will only become bigger.

When you show the form in a "container", the container the form is shown in might become smaller, but the form will not become smaller. Based on the settings, there will be scrollbars or not.

Paul

Re: formwidth not working correct

PostPosted: Mon Feb 28, 2011 10:18 am
by Boudewijn
hey Paul,

You state: because the form is NEVER going to become smaller as you designed it

and what If I want to automatically adjust the form to the screen settings of the user?
Should I telll them to buy new screens so they match my screens (2*24")

I think that would not make me very popular... Much like MS telling people to buy a new PC if they want to switch from XP to WIn 7
What I mean is that if the USER wants to make the form smaller (because they have smaller screen attached to the computer) than the original layout I want all controls on it adjusted accordingly (using anchors) and not bother the user with scrollbars.

Re: formwidth not working correct

PostPosted: Mon Feb 28, 2011 10:27 am
by pbakker
No Boudewijn,

You design for the minimal resolution you want your application to support and let it grow from there.

You see this in any application: when you make the window smaller and smaller, at a certain point you'll get scrollbars (or the content just goes off screen and the user cannot access it anymore, without making it bigger).

Of course you can always do your own layout in the onResize event and through the solutionModel you can change every aspect of the Form and it's elements. So you have complete freedom to do things as you like.

Paul