Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why my AfterRowColChange not functioning properly
Message
De
17/11/2004 09:34:41
 
 
À
17/11/2004 08:23:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00962129
Message ID:
00962165
Vues:
13
Personally I add a property (say nrec) to my grid class and stored in its afterRocolChange method this.nrec = recno(this.recordsource)
then set in its init method
this.setall("DynamicBackColor", "IIf(recno() = nrec,HighlightColour,NormalColour)),"column")
doing that u should only set the focus and then refresh each of your grid to have their current record highlighted.
HTH
Alessio
>Hi Chaps
>
>I have a grandmother-mother-daughter group of 3 grids. As I navigate through each of the parents the child(ren) grid(s) refresh fine, with the correct data pertaining to their parent keys.
>
>BUT, as per an earlier thread, I need to leave a coloured marker in each parent grid, when I go to as child, so the user can trace the "inheritance" trail (otherwise one doesn't know from which parent grid item the child derrives its data).
>
>When I put code in the AfterRowColChange() of the middle grid, the cursor always goes back up to the top of the grid, and the code always returns values pertaining to the record at the top. i.e. if I click on a record in the middle of the grid, AfterRowColChange() treats it as that at the top. In other words it's as if its reponding to a BEFORERowColChange() and not the cureently selected row. I'm up the wall with this - can anyone see the problem?
>
>Below is the AfterRowColChange() code for the middle grid:
>
>LPARAMETERS nColIndex
>LOCAL 		lcCatCode, lnFacCatCode, lcAlias, lcFilter, lnRecNo
>
>Select pxCOMPLETE             && Source of the grid in question
>lnRecNo		= RECNO()   && THIS always returns that of record top of grid and not newly selected row
>lcCatCode		= pxCOMPLETE.CATCODE
>
>* If the parent completion record of a classn. has an mPlan Fac. Cat. Code assigned to it then filter the
>* available Fac. Desc. records, for the combo, to only those that belong to the assigned fac. cat. code (or
>* those that belong to none - i.e. not got a cat yet.
>* Otherwise un-filter Fac Desc table (in case it was filtered)
>* NOTE this goes in a selection combo in one of the grid cells of the child table
>* ____________________________________________________
>lnFacCatCode	= pxComplete.FacCatCode
>Select FACDESC	
>If EMPTY( lnFacCatCode)
>    Set Filter To
>Else
>    lcFilter	= "FAC_CAT_CODE = " + ALLTRIM( STR( lnFacCatCode)) + ;
>                   " OR EMPTY( FAC_CAT_CODE)"
>    Set Filter To &lcFilter
>Endif
>Locate	
>Thisform.grdClassn.Refresh()   && This grid's child grid
>
>Select pxCOMPLETE
>Replace all PXCOMPLETE.lSELECTED with .F.  && used to mark current rec with dynamicbackcolor
>GOTO lnRecNo                               && SHOULD be currently selected row but goes to top
>Replace PXCOMPLETE.lSELECTED with .T.      && used to mark current rec with dynamicbackcolor
>
>Thisform.lEntryCodes	= .F.
>Thisform.Refresh()
>Thisform.LockScreen	= .F.
>
>
>and thisform.Refresh():
>
>
>With thisform
>  If .lEntryCodes
>      .grdEntryCodes.Column2.DynamicBackColor = "IIF( PXENTRYCODES.lSELECTED = .F., ;  			                                             RGB( 255, 255, 255), RGB( 255,128,128))"
>  Else
>      .grdCompletion.Column2.DynamicBackColor = "IIF( PXCOMPLETE.lSELECTED = .F., ;								       RGB( 255, 255, 255), RGB( 255,128,128))"
>  Endif
>Endwith
>
>
>The bizarre thing is that the correctly clicked on row gets highlighted with the DynamicBackColor but the cursor shoots back up to the 1st rec in the grid. Debug always shows the 1st rec as selected, and the datasession window corroborates.
>
>This (including the filter code to fill the combo) worked fine before the DynamicBackColor stuff was added. This parent's grid has similar code for setting the LSELECTED flag on the table and, of course, invokes the same thisform.refresh() (hence the 2 cases in that code) and works fine. But it doesn't do any of the combo-filling filtering
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform