Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid - CursorAdapter
Message
De
02/12/2005 23:34:39
 
 
À
30/11/2005 10:11:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01073232
Message ID:
01074532
Vues:
29
This message has been marked as a message which has helped to the initial question of the thread.
Hi!

"In the grdCustomer's AfterRowColChange Event I have tried calling the cursoradapter's CursorRefresh() and CursorFill() -ThisForm.DataEnvironment.cadOrders.CursorRefresh()/CursorFill() methods and the grid looses all its column settings because a new underlying cursor gets created each time I call CursorRefresh() or CursorFill()."

I've had the same problem some time ago - which VFP developer hasn't stumbled across this one yet?! :)

"Other than saving the grids columns settings .."

That's the best option IMHO and it isn't that complicated at all.
One also doesn't have to save all options. The only thing the following code does is to ensure that the current columns don't loose their settings in the first place.

the code from my grid-baseclass:
FUNCTION Grid::Init()
 LOCAL loCol
 THIS.AddProperty('OriginalRecordSource',THIS.RecordSource)
 FOR EACH loCol IN THIS.Columns
  loCol.AddProperty('OriginalControlSource',loCol.ControlSource)
 ENDFOR
ENDFUNC

FUNCTION Grid::Lock()
LOCAL loCol
THIS.RecordSource = ""
FOR EACH loCol IN THIS.Columns
 loCol.ControlSource = ""
ENDFOR
ENDFUNC

FUNCTION Grid::Unlock()
LOCAL loCol
THIS.RecordSource = THIS.OriginalRecordSource
FOR EACH loCol IN THIS.Columns
 loCol.ControlSource = loCol.OriginalControlSource
ENDFOR
ENDFUNC
usage is quite simple, just call the grid's Lock() method before you're
rebuilding it's underlying cursor (what code is used to rebuild the cursor doesn't matter) and Unlock() afterwards.

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform