Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid Refreshing
Message
 
 
À
17/09/1998 18:05:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00137946
Message ID:
00138459
Vues:
24
<snip>

replied to bruces message by mistake. reposting this to get keith a copy in his mailbox.

probably more than you wanted to know but i have the exact same situation as you - needed to zap a file so had to open exclusive. i had an additional situation where one screen closed all the databases, did some processing and then reopened them. so i wrote a routine to save all the grid recordsources before i went to this process, and then restore the recordsources after i came back. i had to do more than the recordsources. i found i also had to record the controlsources (my grid did not show all fields in the table), and the columncount.

it probably count be a little slicker, but i a struggling vfp programmer.


GRID_SAVE_RECORDSOURCE

**** this routine saves the recordsource, number of columns, column control source for each grid.
**** if you are messing with the grid recordsource (like set and create view, delete and recreate
**** the file, eec) you need to set the recordsource = "" and
**** recordsourcetype = 0. when you are done messing with then recordsource, you need to restore
**** the recordsource, recordsourcetype, columncount, columns.controlsource.
****
**** if grid is visible, should osdi.lockscreen = .t. before calling this and then
**** osdi.lockscreen = .f. after grid_restore_recordsource

**** to add a new grid or change an existing grid:
**** - add/change grid name in acon_gridname
**** - modify maxnumgrids (if adding or deleting grid)


PUBLIC agridname[1] aControlsource[2], arecordSource[1], acolumncount[1], numgrids

maxnumgrids = 5 && change 1 of 2 to add/delete grid
dimension agridname[maxnumgrids]
dimension aControlSource[maxnumgrids,50]
dimension arecordsource[maxnumgrids]
dimension acolumncount[maxnumgrids]
numgrids = 0

dimension acons_gridname[maxnumgrids] && change 2 of 2 to add/delete/change grid
acons_gridname(1) = "osdi.lotinv.grid1"
acons_gridname(2) = "osdi.equity.grid1"
acons_gridname(3) = "osdi.omainscr.page3.collat.grid1"
acons_gridname(4) = "osdi.omainscr.page6.draw1.draw1grid"
acons_gridname(5) = "osdi.omainscr.page6.draw2.draw2grid"


FOR gridnum = 1 to maxnumgrids
*** build the "gridname" (with the quotes)
gridname_quotes = '"'+acons_gridname(gridnum)+'"'
*** does it exist? is it not undefined?
if !(type(&gridname_quotes) == "U")
numgrids = numgrids + 1
*** save the grid's name
agridname(numgrids) = acons_gridname(gridnum)
*** save the grid's coluumn control source
FOR nCnt = 1 TO &agridname(numgrids)..ColumnCount
aControlsource(numgrids,nCnt) = ; &agridname(numgrids)..Columns(nCnt).ControlSource
ENDFOR
*** save the grids's recordsource
arecordsource(numgrids) = &agridname(numgrids)..recordsource
*** save the grids's columncount
acolumncount(numgrids) = &agridname(numgrids)..ColumnCount
*** set the grid's recordsource to space(0)
&agridname(numgrids)..recordsource = space(0)
*** set the grid's recordsourcetype to 0
&agridname(numgrids)..recordsourcetype=0
endif
endfor

GRID_RESTORE_ RECORDSOURCE

*** restore each grids recordsource, recordsourcetype, columncount and each columns controlsource
**** should osdi.lockscreen = .f. after this (if it was = .t. beofore grid_save_recordsource)

FOR gridnum = 1 to numgrids
&agridname(gridnum)..recordsourcetype = 1
&agridname(gridnum)..recordsource = arecordsource(gridnum)
&agridname(gridnum)..columncount = acolumncount(gridnum)
FOR nCnt = 1 TO acolumncount(gridnum)
&agridname(gridnum)..Columns(nCnt).ControlSource = ; aControlsource(gridnum,nCnt)
ENDFOR
&agridname..refresh()
endfor
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform