Hi Kevin,

you no longer need to zap and append to your cursor; you can just:

.RecordSource = '' && used to be 'myCursor'
select ... into cursor myCursor
.RecordSource = 'myCursor'

this might make .AutoFit() work better

Thierry Nivelet
FoxInCloud
Give your VFP app a second life in the cloud
http://foxincloud.com/

Le 18/06/2015 17:16, Kevin Cully a écrit :
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/5582f488.2000...@foxincloud.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.

Reply via email to