>Hi there,
>
> I have a grid and want to allow the user to edit only specific records in it.
>
> Can I enable or disable rows dynamically in a similar way to how I can change their background colour by through the DynamicBackColor property?
>
>
>Any help would be greatly appreciated,
>
>Thanks,
>
>
>Mark
You can do both:
1) DynamicBackColor:
*** grid.init event
This.Setall('DynamicBackColor','IIF(myrecordsource.myfield=25,0,255)','Column')
This code will set black backcolor for all records (rows) in recordosurce where field 'myfield' equals to 25 (you can use your own value or use form property here).
2) 'Dynamic' enabling:
Add two controls to each column where you want to have this behavior: e.g. add two textboxes 'Text1' and 'Text2'. These textboxes will be identical except their Enabled property: Text1.Enabled=.T. and Text2.Enabled=.F. Now you use DynamicCurrentControl property:
*** grid.init event
This.Setall('DynamicCurrentControl',"IIF(myrecordsource.myfield=25,'Text1','Text2')",'Column')
Edward Pikman
Independent Consultant