Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validating current row - current cell problem
Message
De
19/12/2011 12:21:20
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01531359
Message ID:
01531375
Vues:
105
This message has been marked as the solution to the initial question of the thread.
>>>>>Hi everybody,
>>>>>
>>>>>I'm calling ValidateCurrentRow method from the Valid and BeforeRowColChange events of the grid. Everything seems to work as I want with one minor problem: suppose, I'm on the particular cell in the grid (the column that requires validation) and I click a button outside the grid after entering a value in that cell, I still get a validation message. So, the valid event of the textbox doesn't happen.
>>>>>
>>>>>How can I ensure that the valid method of that cell happened before the validation takes place?
>>>>>
>>>>>Thanks in advance.
>>>>
>>>>SetFocus to the cell
>>>
>>>I don't think you can call SetFocus from the Valid method. Also, can you be more specific, how would I know from the ValidateCurrentRow method (called from Valid or BRCC) which column to set focus to?
>>
>>You'll have to test whether a BRCC fires the Valid(). If it does not, I don't think the value of the cell will get updated in the controlsource
>
>This code below almost works. It works for all columns except for description column. When I test ActiveColumn it seems to refer to the Expiration date column instead of the description. See attached picture (validation works correctly for SeatEnd or Expiration date when I change the value and then press Add Hold button).
>
>
>local lnActiveColumn, loControl, loColumn
>lnActiveColumn = this.activecolumn
>if  m.lnActiveColumn> 0
>   loColumn = this.columns(m.lnActiveColumn)
>   if vartype(m.loColumn) = 'O'
>      for each loControl in loColumn.Controls foxobject
>         if pemstatus(loControl, 'value',5)
>            loControl.value = loControl.value
>         ELSE
>            if pemstatus(loControl, 'valid',5)
>               loControl.valid()
>            endif   
>         endif
>      next
>   endif
>endif
>
>
>And see attached picture.


The activeColumn is not the index in this.Colums[ ]

To get the column object, loop through the column collection. The column with ColumnOrder == activeColumn is the one you need
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform