Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid jumps after re-ordering the record source
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01032650
Message ID:
01032897
Vues:
28
>Nadya,
>
>Here's the Reorder() method of my grid class:
>
>
>lparameter pcOrder, plAscending
>
>local i, j, llLockScreen, lnRecno, lnRelativeRow, lnDirection, lcDescending
>
>llLockScreen = thisform.LockScreen  && prevent user from seeing all of the jumping
>thisform.LockScreen = .t.
>
>lnRecno = recno()
>lnRelativeRow = this.RelativeRow
>lcDescending = iif( ! plAscending, "descending", "ascending" )
>set order to pcOrder &lcDescending
>this.Refresh()
>
>goto lnRecno                        && move record pointer back
>this.Refresh()
>
>if ( lnRelativeRow != this.RelativeRow )
>   * the record didn't wind up at the same grid row, so we scroll the grid
>
>   lnDirection = iif( lnRelativeRow > this.RelativeRow, 0, 1 )
>   j = abs( lnRelativeRow - this.RelativeRow )
>   for i = 1 to j
>      this.DoScroll( lnDirection )
>   endfor
>
>   this.Refresh() && YAR
>endif
>
>thisform.LockScreen = llLockScreen
>
>
>>Perhaps I asked this question already. There is one annoying behavior of the grid, which I need to overcome. When I click on the column's header, I'm re-ordering on that field and I'm still on the same record. Is where a way to avoid scrolling up or down of the grid? E.g. grid should remain with the same amount of records before the selected record and after it?
>>
>>Or it is impossible without changing the record position?

David,

Thanks a lot to you and Fabio for the code. I'm going to try it tomorrow...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform