Re: Grid Autofit

Author: Koen Piller

Posted: 2015-06-18 at 11:23:29

Hi,

I miss:

THISFORM.Pageframe1.Page1.grdSales.RecordSource = blahblah1.dbf

THISFORM.Pageframe1.Page2.grdLabor.RecordSource = blahblah2.dbf

also

AutoFit is a method, by default the columns are 'autofit', in your case you

give nothing in the method in my opinion superfluous

Rgds,

Koen

2015-06-18 17:29 GMT+02:00 Kurt Wendt <Kurt_Wendt@globetax.com>:

> Kevin - although I have never used the Autofit Method (only the equivalent

> Property) - I saw in the Online help that it Returns a .T./.F. value based

> upon if it was successful.

>

> Have you tested the return value? In your code below - I see that you are

> not even capturing the return value.

>

> Anyway - it's just a thought...

>

> -K-

>

> -----Original Message-----

> From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kevin

> Cully

> Sent: Thursday, June 18, 2015 11:16 AM

> To: profoxtech@leafe.com

> Subject: Grid Autofit

>

> I'm working on a VFP form and I don't think I'm using a best practice for

> AUTOFITting a grid. I've a pageframe with two pages, each page has a grid.

> Many of these parent records have zero child sales records and/or labor

> records. What's the best practice to get the grids to AUTOFIT reliably?

>

> Grids are set as:

> ReadOnly = .T.

> AllowCellSelection = .F.

>

> In the THISFORM.LOAD() event, I create a cursor that I leave open for the

> life of the form. When I navigate through the order records, I SQL SELECT

> the child records, select the cursor that was created in the LOAD(), ZAP

> it, and then append records from the cursor for the display of the child

> records. This saves me from using views, and the binding/unbinding problem

> with grids.

>

> Here's the code I use to try to get that grid to autofit properly. This

> code is *after* I've reloaded the records in the child cursor.

>

>

> THISFORM.LockScreen = .T.

> && Lots of business stuff... including reloading the child cursor.

> THISFORM.LockScreen = .F.

>

> THISFORM.Pageframe1.Page1.grdSales.AutoFit()

> THISFORM.Pageframe1.Page2.grdLabor.AutoFit()

> THISFORM.Refresh()

>

> The grids still aren't displayed with the optimized field sizes.

> Harumph. Thanks for any help.

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/CACUu1SvpmQeaezYMnV02g88z4LNpcrPEMyhJ=_xNhiFhLxX0tA@mail.gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2015 Koen Piller