Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Columns Resizing After Packing Table
Message
From
31/01/2004 07:31:32
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00871935
Message ID:
00872641
Views:
19
You should add two methods to your grid baseclass, i give an example from MVP Luis M Guayan, in the first one you keep yor grid configuration .So before packing your table yoo must execute thisform.mygrid.PreservarColumnas() and after packing thisform.mygrid.RestaurarColumnas('yourtable')and this will restore al your grid settings

*-- Grid::PreservarColumnas
LOCAL lo
FOR EACH lo IN THIS.COLUMNS
STORE lo.CONTROLSOURCE TO ("lo."+lo.CURRENTCONTROL+".Tag")
ENDF
THIS.TAG = THIS.RECORDSOURCE
THIS.RECORDSOURCE=""
*-- Grid::RestaurarColumnas
LPARAMETERS lcAlias && si no está en la grilla debe especificarse acá
LOCAL lo, lc
THIS.RECORDSOURCE = IIF(NOT EMPTY(lcAlias),lcAlias,THIS.TAG)
FOR EACH lo IN THIS.COLUMNS
lc = EVAL("lo."+lo.CURRENTCONTROL+".Tag")
IF NOT EMPTY(lc)
IF NOT '.'$lc && sin alias asignado: lo asigna ahora
lc = THIS.RECORDSOURCE+'.'+lc
ENDIF
lo.CONTROLSOURCE = lc
ENDIF
ENDFOR

Notwithstanding advice you've received in this thread, I'm curious why you have to disassociate your table from the grid at all when you pack it. Surely you'd just see the grid "twitch" as records are packed? Unless "myTable" is a different table from your original. Now I've never packed a table while it's showing in a grid, so I don't know if there are undesirable side-effects.

Just curious.

Terry (McD)

>I'm resetting the RecordSource to "" and then to "MyTable" but the columns resize to what I think is the default size of the field lengths. What gives? I don't want to have to put a bunch of column widths into the grid. Why do they resize? Thanks!
>
>Regards, Renoir
Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform