Have you tried refreshing the specific containers (i.e. the grid itself or the 
page or the pageframe)?

--

rk
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Kevin Cully
Sent: Thursday, June 18, 2015 11:16 AM
To: profoxt...@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.


_______________________________________________
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/bn4pr10mb0913c572d21052def8dfaf30d2...@bn4pr10mb0913.namprd10.prod.outlook.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