BufferMode

Height, Width

These properties, not surprisingly, control the height and width of visual objects, including forms and controls.

Usage

oObject.Height = nValue nValue = oObject.Height oObject.Width = nValue nValue = oObject.Width
The size of an object is measured in the current ScaleMode.

Height and Width are measured differently from each other and differently for different objects. For forms, Height and Width exclude borders and titles. For controls, Height includes the border, but Width is measured from the center of the border. According to the docs, measuring a control's width this way makes it easier to line up controls with different borders. We're not sure we see the point.

You can change the size of an object by modifying Height and Width. However, controls contained in grid columns can't be resized.

Example

frmMyForm = CREATEOBJECT("form") frmMyForm.SHOW() frmMyForm.Height = frmMyForm.Height + 20 frmMyForm.Width = frmMyForm.Width * 1.5
The example demonstrates that you can make changes relative to existing values. You can use this ability to size contained objects to fit inside the container—for example, making sure a certain set of controls fits into a form.

Example

* Resize Demo   frmResizeDemo = CREATEOBJECT("ResizeForm") frmResizeDemo.Show() READ EVENTS   DEFINE CLASS ResizeForm as Form   ScaleMode = 0  && Note that this is foxels for simplicity   MinHeight = 10   Add Object edtNote as Speech   Add Object btnQuit as QuitButton      * Custom Properties   nQuitBtnMargin = 3   nEdtBoxMargin = 5   PROCEDURE Init     This.ReSize()   ENDPROC      Procedure ReSize     ThisForm.btnQuit.Top = ThisForm.Height - This.nQuitBtnMargin     ThisForm.btnQuit.Left = (ThisForm.Width - ;                              ThisForm.btnQuit.Width ) / 2     ThisForm.edtNote.Height = ThisForm.Height - ;                               ThisForm.nEdtBoxMargin     ThisForm.edtNote.Width  = ThisForm.Width - ;                               2*ThisForm.edtNote.Left   ENDPROC      PROCEDURE Destroy     CLEAR EVENTS   ENDPROC ENDDEFINE   DEFINE CLASS QuitButton AS CommandButton   Caption="Quit"   HEIGHT = 2   PROCEDURE Click     CLEAR EVENTS   ENDPROC ENDDEFINE   DEFINE CLASS Speech AS EditBox   Left = 3   Value = "Four score and seven years ago " + ;           "our fathers brought forth on " + ;           "this continent a new nation, conceived " + ;           "in liberty and dedicated to the proposition " + ;           "that all men are created equal." ENDDEFINE
For a form, Height and Width are constrained by MaxHeight, MinHeight, MaxWidth and MinWidth. Regardless of the values you assign, the Height and Width will never go beyond those boundaries.

See Also

Left, Top, MaxHeight, MaxWidth, MinHeight, MinWidth, ScaleMode


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