VFP8 SP1 on XP Pro SP1

I have a form with a grid on it. In code, the grid is
configured to display the contents of a table that is
selected by the user. Part of this configuration process
is to use checkboxes for fields that are logicals. Using
code like this:

WITH myGrid.Columns[curCol]
.AddObject("chkVal","CHECKBOX")
.CurrentControl = "chkVal"
.Sparse = .F.
.chkVal.Caption = ""
.AutoFit()
ENDWITH

This works fine with the exception of the call to AutoFit().
The column's width remains much wider that required for the
header caption or the checkbox. Refreshing the grid does not
help. Nor does removing the default "Text1" control in
the column before calling AutoFit(). Nor does reducing the
Width property of the chkVal checkbox to 30.

Is there something else that needs to be done to get this to
work? I am successfully using AutoFit() on other columns
that just have the default textbox in them, but when the
checkbox is substituted, it's not workin'.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________

Re: AutoFit not working by Roger

Roger
Sat Mar 26 08:21:38 CST 2005

From VFP8 Help ...
"For Column objects, AutoFit works only with TextBox controls."

But you could resize the column with something like
.Width = .chkVal.Width + 2 && or some other value

-Roger

Tim Witort <trw7at@ixdot.netcomdotcom> wrote:
> VFP8 SP1 on XP Pro SP1
>
> I have a form with a grid on it. In code, the grid is
> configured to display the contents of a table that is
> selected by the user. Part of this configuration process
> is to use checkboxes for fields that are logicals. Using
> code like this:
>
> WITH myGrid.Columns[curCol]
> .AddObject("chkVal","CHECKBOX")
> .CurrentControl = "chkVal"
> .Sparse = .F.
> .chkVal.Caption = ""
> .AutoFit()
> ENDWITH

> This works fine with the exception of the call to AutoFit().
> The column's width remains much wider that required for the
> header caption or the checkbox. Refreshing the grid does not
> help. Nor does removing the default "Text1" control in
> the column before calling AutoFit(). Nor does reducing the
> Width property of the chkVal checkbox to 30.
>
> Is there something else that needs to be done to get this to
> work? I am successfully using AutoFit() on other columns
> that just have the default textbox in them, but when the
> checkbox is substituted, it's not workin'.

Try

>
> -- TRW
> _______________________________________
> t r w 7
> at
> i x dot n e t c o m dot c o m
> _______________________________________




Re: AutoFit not working by trw7at

trw7at
Mon Mar 28 10:10:03 CST 2005

Roger Ansell seemed to utter in news:OCmbh8gMFHA.3988@tk2msftngp13.phx.gbl:

> From VFP8 Help ...
> "For Column objects, AutoFit works only with TextBox controls."

You know... I read the help for AutoFit a few times and for the
life of me, I cannot remember seeing that. But there it is, big
as life! Thanks, Roger. I'll do the resize in code.

-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________