Subject Re: Grid Editing
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 20 Dec 2014 10:17:16 +0200
Newsgroups dbase.getting-started

On Sat, 20 Dec 2014 09:29:37 +0200, safarini <pccenter.safarini@libero.it>  
wrote:

> Hi,
>
> How can i be allowed to edit certain row column fields in a grid but not  
> others so that i can enter the allowed fields and not allowing to enter  
> the other fields.
>
> Thank you


Set the readonly property for the required fields to true.  In theory one  
should be able to do this from within the Inspector which would then  
modify the constructor code for the query when the form is saved.



    this.queryname = new QUERY(this)
    with (this.queryname)
       left = 4.0
       top = 8.0
       sql = 'select * from "myfile.DBF"'
       active = true
    endwith

    with (this.queryname.rowset)
       fields["whatever"].readOnly = true
       fields["something"].readOnly = true
    endwith


In practice this works in dBASE 2.8 but doesn't happen in dBASE 8.1.3 and  
the bug may have been carried over into dBASE 9.5.  (I don't have dBASE  
9.5 so I can't check it.)  If this is the case, the easiest way round this  
is to set the property in the form's onOpen event handler.

I haven't tried editing the constructor code in the sourcecode editor in  
dBASE 8.1.3 but there is a good chance that if you then open the form in  
the designer it will discard the changes.  By placing the changes in the  
form's onOpen event handler the designer will leave them alone.



    function form_onOpen
       this.queryname.rowset.fields["whatever"].readonly := true
       this.queryname.rowset.fields["something"].readonly := true
       return


Mervyn.