I didn't try that particular code, but I know that I used AfterRowColChange event in the past to set the readonly property.
Try something else
dodefault(nColIndex)
if myField = 1
this.SetAll('readonly',.f., 'column')
else
this.SetAll('readonly',.t., 'column')
endif
not tested.
>Hello NAOMI,
>
>Did you tried ?
>
>I placed your code in grid of Nick in WHEN and /or AfterRowColChange but Not Succes ?
>
>A idea ?
>
>Good evening
>
>bernhart
>
>
>>>Bonjour Naomi,
>>>
>>>
>>>I look the method AfterRowColChange
>>>Occurs when the user moves to another row or column in the Grid, after the new cell gets the focus, and after the When event of the object in the new row or column. The AfterRowColChange event doesn't fire unless the When event of the object in the new row or column returns true (.T.).
>>>
>>>
>>>I try this code in my when grid method
>>>
>>>IF MOD( RECNO() , 2 ) = 0
>>>RETURN .T.
>>>ELSE
>>>RETURN .F.
>>>ENDIF
>>>
>>>The complete grid is read only !
>>>
>>>Can you give me a sample please ?
>>>
>>>bernhart
>>>
>>
>>
>>Try in this method
>>
>>this.ReadOnly = mod(recno(),2) = 0
>>
If it's not broken, fix it until it is.
My Blog