CREATE MENU

ScaleMode

This property determines whether a form or toolbar measures things in pixels or in foxels.

Usage

oObject.ScaleMode = nScaleMode nScaleMode = oObject.ScaleMode
ScaleMode has only two possible values: 0 for foxels, 3 for pixels. Given the choice of values, we've sort of expected some other choices (points? inches? twips?) to turn up. Other values are used in other products, but we're pretty happy not having to do the pixel-to-twip conversion, ourselves.

A pixel (the term stands for "picture element") is the smallest addressable unit on the monitor. When you say a monitor supports 1024x768, you're saying it has at least 1024 pixels across and 768 up and down.

A foxel is a FoxPro invention created so that FoxPro developers wouldn't have to think in pixels in Windows, and rows and columns in DOS. After all, can you really tell whether an item is 200 pixels from the top or 201? (Actually, we can if one item is 200 pixels from the top and another is 201. But if they line up neatly at either position, that pixel doesn't matter much.) A foxel is more or less the size of a character in the current font. (Actually, foxels might not be a FoxPro invention, just a FoxPro name for the idea. Someone once told us about something called a "dialog box unit" that sounds an awful lot like a foxel. Microsoft uses dialog box units to specify many of the dimensions within their interface standards.)

By default, forms and toolbars use pixels. Since you don't have to actually specify values for anything (just do it visually), we generally agree with this choice and work in foxels only rarely. Windows is a pixel-based environment and you'll probably be much happier keeping ScaleMode=3 throughout your applications.

ScaleMode is part of what Doug refers to as an "obscure" bug. You have to do just the right set of things to trigger this one, but if you do, boom! VFP GPFs. (Hey, a whole sentence with no vowels. Cool!)

Here's the setup. If you're working in design mode and an object is selected, and you run a builder that removes the selected object from the form with RemoveObject, changing the form's ScaleMode afterward causes a crash. Weird. Even weirder is that if you omit any of the pieces (like removing a different object), there's no crash.

We're not sure exactly how ScaleMode figures into this bug, because you also cause a crash by removing the selected object and clicking into the Property Sheet. In any case, be forewarned.


Example

DO CASE CASE ThisForm.ScaleMode = 3    * Using pixels, move one character down.    This.Top = This.Top + FONTMETRIC(1) CASE ThisForm.ScaleMode = 0    * Using foxels, move one character down.    This.Top= This.Top + 1 ENDIF

See Also

FontMetric(), SysMetric(), TxtWidth()


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