Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid BeforeRowColChange
Message
De
26/11/1999 11:07:28
 
 
À
26/11/1999 09:45:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00295681
Message ID:
00295738
Vues:
26
>Hi Rex,
>
>>How can I tell in the Grid.BeforeRowColChange method if I am trying to change the Row or the Column in the grid?
>
>If you can wait untill AfterColRowChange its easier (save the column number, save it in a property and compare it too tnColIndex), but the only way I know how to do it in Before.. is like this:
>
>
LPARAMETERS nColIndex
>
>if inlist(lastkey(), 5, 24)
>	debugout 'Row Changed'
>else
>	debugout 'Col Changed'
>endif
Now, this will not tell you accuratly when you choose a cell with the mouse, or programmatically. You should be able to trap that though, Good Luck!

I use this code that Cetin posted here some months ago:

WITH this
IF mdown()
lnBottom = .top+.headerheight+.relativerow * .rowheight
lnTop = lnBottom - this.rowheight
lnMouseRowPos = mrow(wontop(),3)
lnMouseColPos = mcol(wontop(),3)
llChangingRow = !(between(lnMouseRowPos,lnTop, lnBottom) ;
and between(lnMouseColPos,.left,.left+.width))
* Is click on a different row
ELSE
llChangingRow = inlist(lastkey(),24,5,18,3)
* Was lastkey() in Up,down, pgup,pgdown
ENDIF
ENDWITH

Works beautifully. I have implemented it in my base grid class, and created two new hook methods, BeforeRowChange, and BeforeColChange, and I call one of them conditionally depending on the value of llChangingRow.

BTW, Thanks, Cetin.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform