RE: Control margins used by grid AutoFit()

Author: Malcolm Greene

Posted: 2004-05-14 at 13:09:11

Hi Nancy,

Thanks for the tip (re: use Textbox .Margin property) - it works - sort

of - but I think it also uncovers an AutoFit() bug or two.

1. AutoFit() appears to ignore the .Margin setting and autosizes based on

length of TextBox contents - not length of contents - .Margin * 2.

2. Cell highlighting within a cell with .Margin > 0 will only highlight

the data entry area within the TextBox - not the entire cell.

Code to reproduce these behaviors is included following my signature.

Are these worthy of bug reports to MS or are these behaviors "by design"?

Do you think I should re-title this thread some along the lines of

"Strange Grid behavior when textbox .Margin > 0"?

Thanks again for your help!

Malcolm

<open a table with 4 or more columns>

browse name loBrowse nowait

wait window "Before margin resize"

* NOTE: Have to set .Sparse to .F. to see .Margin effect

loBrowse.Column1.Text1.Margin = 8

loBrowse.Column1.Sparse = .F.

loBrowse.Column2.Text1.Margin = 8

loBrowse.Column2.Sparse = .F.

loBrowse.Column3.Text1.Margin = 8

loBrowse.Column3.Sparse = .F.

loBrowse.Column4.Text1.Margin = 8

loBrowse.Column4.Sparse = .F.

loBrowse.Refresh()

* after margin resize the whitespace looks good!

* BUT (another topic?) ugly cell highlighting

wait window "After margin = 8"

loBrowse.AutoFit()

loBrowse.Refresh()

* AutoFit doesn't appear to take into consider .Margin setting

wait window "After autofit"

----- Original message -----

From: "Nancy Folsom" <lists@pixeldustindustries.com>

To: profoxtech@leafe.com

Date: Fri, 14 May 2004 10:05:33 -0700

Subject: RE: Control margins used by grid AutoFit()

Malcolm-

> VFP 8: Is there anyway to control the margins that VFP uses

> when a grid's

> .AutoFit() method is called? The default behavior of the

> AutoFit method is to very tightly size column sizes. I would

> like to have a little more whitespace between columns.

I know I should test this before posting, but does using the margin

property

help?

Regards-

Nancy Folsom

Pixel Dust Industries

Author _Debugging_Visual_FoxPro_Applications_

http://www.hentzenwerke.com/catalogpricelists/debugvfp.htm

[excessive quoting removed by server]

©2004 Malcolm Greene