function EditCell( CtrlEntId, EditMode )

declare function get_property, sendmessage

equ wm_user$           to 1024
equ dtm_editcurrcell$  to wm_user$ + 95
equ EditTableInsDel$ to 4
equ dt_beginedit$      to 1
equ dt_endedit$        to 2
equ dt_abortedit$      to 3

* Check to see if the edit table has been protected from 
* row insertion and deletion. If so then don't go into edit
* mode because it has been protected by scroll_enable cause the
* user does not have edit rights

Style = get_property( CtrlEntId, "STYLE" )
if Style[1,2] _eqc "0x" then
   convert @lower_case to @upper_case in Style
   Style = iconv( Style[3,999], 'MX' )
end
InsDelProtect = ( bitand( Style, EditTableInsDel$ ) = 0 )
if InsDelProtect then
   * HAS BEEN PROTECTED BY SCROLL_ENABLE SO SIMPLY RETURN
   return 0
end
if Assigned(EditMode) else
    EditMode = ''
end
if len(EditMOde) else
    EditMode = dt_beginedit$
end
Htable = get_property( CtrlEntId, 'HANDLE' )
Message = dtm_editcurrcell$
return sendmessage( Htable, Message, EditMode, '' )
