CREATE CONNECTION

Resize

This event fires each time an object is resized.

Usage

PROCEDURE oObject.Resize [ LPARAMETERS nIndex ]
You can ignore the optional parameter to Resize unless you're using control arrays. If you are, read that section so we can convince you to stop.

A Resize event occurs each time a user resizes a container control whose properties allow resizing. A Resize event also occurs if the properties that control the size of a container (Height and Width) are changed programmatically. Classes based on any of the following "containing controls" have Resize events: Container, Control, Form, Grid, Column, OLEControl, OLEBoundControl, Pageframe and Toolbar. Different controls have different properties that determine if they can be resized interactively. For a column, the Resizable property has to be True. For a Form, BorderStyle must be set to 3. Sizable is the relevant property for the OLEControls. All the other objects must be resized programmatically for the Resize event to fire.

You might choose to refresh certain objects within a Resize event, such as ensuring that all buttons are still visible on a form, or shrinking text and label font sizes to fit a new column size. Resize events are a handy place for the code to resize or rearrange controls within a container. Check out the _resizable control that comes with the FoxPro Foundation Classes before trying to write your own.

One caution when resizing controls: Ensure that the container control hasn't been shrunk too small to hold a control before changing the contained control's properties, or an error could result. You might need to take advantage of the MinHeight and MinWidth properties of a form, or programmatically check limits for the other containers before manipulating contained objects.

Example

Procedure Form1.Resize * Move the Quit button to 50 pixels from the bottom of the form ThisForm.cmdQuit.Top = ThisForm.Height - 50 * Center the button horizontally ThisForm.cmdQuit.Left = .5 * (ThisForm.Width - ;                               ThisForm.cmdQuit.Width) * * The form contains a custom edit box. It needs to take up all; * space left to right except a margin and stretch itself to ; * the height available on the form. * * Make the Width the form width less two margin widths ThisForm.edtEditBox.width = ThisForm.Width - ;                             2 * ThisForm.edtEditBox.Left * * Make the box height 108 pixels plus whatever room is ; * available beyond the minimum form height ThisForm.edtEditBox.Height = 108 + (ThisForm.Height - ;                                     ThisForm.MinHeight)

See Also

BorderStyle, Column, Container, Control, Control Arrays, Form, Grid, Height, MinHeight, MinWidth, OLEBoundControl, OLEControl, PageFrame, Resizable, Sizable, Toolbar, Width


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net