Subject Re: How to make a record conditional uneditable in a Grid
From Gaetano D. <gaetanoddRemoveThis@andThatHotmail.com>
Date Wed, 4 Aug 2021 05:28:04 +1000
Newsgroups dbase.getting-started

On 4/08/2021 04:57, Milind Nighojkar wrote:
> Scenerio :
> In a Grid I want to conditionally make record uneitable based on  value of a field in that record  say field  'status' having value 'Completed'
> Any suggestions?
>
> Milind Nighojkar

Hi Milind,

When the rowset's autoedit property is set to true and you start editing
a field in a grid, the beginEdit() event is automatically fired and so
is the canEdit() event after that. Try to add the check for your
conditions in the canEdit event and return false or true as needed with
an IF/ENDIF block

function query1_canEdit

local bEdit

bEdit=true

if form.rowset.fields["status"].value.tolowercase()<>completed"

    bEdit=false

    msgbox("Cannot edit this fields as the status is not completed")

endif

return bEdit

--
Gaetano.