Index
2004-05-14 11:57Malcolm Greene : Control margins used by grid AutoFit()
2004-05-14 12:05Nancy Folsom : RE: Control margins used by grid AutoFit()
2004-05-14 13:09Malcolm Greene : RE: Control margins used by grid AutoFit()
2004-05-14 17:50Nancy Folsom : RE: Control margins used by grid AutoFit()
2004-05-15 06:59Malcolm Greene : RE: Control margins used by grid AutoFit()
2004-05-15 13:16Dan Covill : RE: Control margins used by grid AutoFit()
Back to top
Control margins used by grid AutoFit()

Author: Malcolm Greene

Posted: 2004-05-14 11:57:14   Link

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.

The only way I can think to do this is to convert all content to a

character data type and then append "N" number of spaces to the front and

back of each value.

Thanks!

Malcolm

©2004 Malcolm Greene
Back to top
RE: Control margins used by grid AutoFit()

Author: Nancy Folsom

Posted: 2004-05-14 12:05:33   Link

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

©2004 Nancy Folsom
Back to top
RE: Control margins used by grid AutoFit()

Author: Malcolm Greene

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

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
Back to top
RE: Control margins used by grid AutoFit()

Author: Nancy Folsom

Posted: 2004-05-14 17:50:33   Link

Hi, Malcolm-

> 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.

I ran your sample. The ugliness you see in the selected cell is the margin,

not anything to do with autofit. I'd never noticed it before but then I

never had such an obvious margin. It's ugly, for sure.

I see what you mean about AutoFit not recognizing the margin setting. Items

are truncated. So, two things, I'd call the latter issue a bug (AutoFit

should account for margins). The issue of padding the columns a bit...It

would be nice if we could, say, pass a parameter to AutoFit that would set a

padding amount. At this point it would seem to be your best bet to autofit,

then go through and increment the columns by a bit--not a great solution,

but still easier than doing the whole calculation ourselves, I guess.

Let me know if you decide to post the bug and/or design change request. If

it's on the UT, I'll vote for it.

Regards-

Nancy Folsom

Pixel Dust Industries

Author _Debugging_Visual_FoxPro_Applications_

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

©2004 Nancy Folsom
Back to top
RE: Control margins used by grid AutoFit()

Author: Malcolm Greene

Posted: 2004-05-15 06:59:36   Link

Hi Nancy,

Thanks for taking a look at my problem! I'm going to post 2 bugs and 2

design change requests.

BUG: Grid control's Autofit() method ignores Column's Textbox .Margin

property resulting in truncated display of Textbox contents.

CHANGE REQUEST: Have the grid control's AutoFit() method take an optional

parameter indicating the amount of margin (in pixels) to add to each

column when sizing columns.

BUG (?) and/or CHANGE REQUEST: Grid cells are not completely highlighted

when a column's Textbox's .Margin is greater than 0. Rather than

highlighting the data entry region of the Textbox control, the entire

grid cell region should be highlighted.

Anyone care to comment/edit these requests before I submit them to MS

(bug reports) and to the UT (change requests).

Thanks!

Malcolm

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

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

To: profoxtech@leafe.com

Date: Fri, 14 May 2004 15:50:33 -0700

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

Hi, Malcolm-

> 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.

I ran your sample. The ugliness you see in the selected cell is the

margin,

not anything to do with autofit. I'd never noticed it before but then I

never had such an obvious margin. It's ugly, for sure.

I see what you mean about AutoFit not recognizing the margin setting.

Items

are truncated. So, two things, I'd call the latter issue a bug (AutoFit

should account for margins). The issue of padding the columns a bit...It

would be nice if we could, say, pass a parameter to AutoFit that would

set a

padding amount. At this point it would seem to be your best bet to

autofit,

then go through and increment the columns by a bit--not a great solution,

but still easier than doing the whole calculation ourselves, I guess.

Let me know if you decide to post the bug and/or design change request.

If

it's on the UT, I'll vote for it.

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
Back to top
RE: Control margins used by grid AutoFit()

Author: Dan Covill

Posted: 2004-05-15 13:16:32   Link

At 07:59 05/15/04 -0400, Malcolm Greene wrote:

>BUG: Grid control's Autofit() method ignores Column's Textbox .Margin

>property resulting in truncated display of Textbox contents.

Does it change anything if you have an InputMask that is wider than the field?

BUG (?) and/or CHANGE REQUEST: Grid cells are not completely highlighted

>when a column's Textbox's .Margin is greater than 0. Rather than

>highlighting the data entry region of the Textbox control, the entire

>grid cell region should be highlighted.

This one may well be by design (or by omission?). Highlighting the entire

box would give the impression that it is possible to enter more characters

than are available in the field. I've had users complain that "the entry

box was chopping off the names", when the box is significantly wider than

the field.

Dan Covill

San Diego

©2004 Dan Covill