Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize form

Status
Not open for further replies.

diem

Programmer
Jul 25, 2001
28
US
Hi,

Does anyone know how to resize all the controls on the form when the user tries to resize the form? If the user tries to make the form bigger, all the controls (such as textbox, labels, command buttons...) have to be made bigger also. Is there a control that can help to do that?

Thank you very much.
 
A good free solution is one provided by Microsoft. Menu -> Tools -> Component Gallery -> Visual FoxPro Catalog -> Foundation Classes -> User Controls -> Resize Object. To use it, just drag and drop it on your form. To learn more about it, right click on it and choose Help from the context menu. It may not give you ALL you want, but it's a good start.

There are other's available on the UT ( - enter resize in the search box - I see at least 10 with varying features and limitations.

Rick
 
rgbean, does this control resize all other controls accordingly to the current size only? There is integer rounding problem - when you resize form larger and smaller several times, you will see controls get lost their original size and proportions. In VFP frameworks this problem solved by storing the original size and location of each control in the special property array for each control, and calculate new size of controls using that array. This guarantee the original size despite you resize form many times.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
I don't like that class either.

I suppose it is cumbersome but I hard code all my resizabe forms. I like command buttons staying the same size. I like textboxes getting wider but not taller. I think labels should just stay as they are. Editboxes and Grids are the only things that actually shrink and grow on my forms. If you do this methodology you generally have to set min height/width in the resize event to prevent errors.

Its really not difficult to do. It usually the last thing I do with a form and only takes a couple of minutes... actually I often layout the form in the resize event too, it is a great way to know your code is working.

Here is an example...

me = thisform &&save typing

*command buttons
me.cmdCancel.left = me.width -12 -me.cmdCancel.width
me.cmdOpen.left = me.cmdCancel.left - me.cmdOpen.width
me.cmdCancel.top = me.height - 12 - me.cmdCancel.height
me.cmdOpen.top = me.cmdCancel.top

*grid
me.grdProjects.width = me.width - 24
me.grdProjects.height = me.cmdCancel.top -12- me.grdProjects.top

*update form
IF me.visible THEN
thisform.refresh
ENDIF


-Pete
 
Vlad,
While I've &quot;played&quot; with a number of resize classes, I've never used any of them in our distributed applications. I've found it easier to require a minimum / optimum size for running the application(s), and if they want any customized sizing, then it's usually easier to create variant forms (plus it adds to the revenues <g>). That way you got complete control over how everything looks.

Rick
 
rgbean, I agree with you, however, when customer want, you have to do it, and have to do it by as best way as possible ;) I worked on the framework were this feature was an requirement, so I thought my notes could be helpful. I agree that see this is quite complex for manual implementation. Anyway, I would recommend to use framework in such case (never mind I said it! ;), that already contain such feature.
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top