以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]求一段代码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=44686)

--  作者:zyys2813
--  发布时间:2014/1/6 20:49:00
--  [求助]求一段代码
新手没基础,求代码
表中有两列 [结账日期] 为日期型  [是否结账]为逻辑型
想实现:
1 结账日期未录入,是否结账 禁止编辑
2 录入结账日期后,是否结账 为true
3 锁定此行
请大师赐教

--  作者:有点甜
--  发布时间:2014/1/6 21:20:00
--  
 1、编写prepareEdit事件

if e.col.name = "是否结账" andalso e.row.isnull("结账日期") then
    e.cancel = true
end if

 2、编写datacolchanged事件

if e.datacol.name = "结账日期" andalso e.datarow.isnull("结账日期") = false then
    e.datarow("是否结账") = true
end if

 3、编写datacolchanged事件

if e.datacol.name = "是否结账" andalso e.newValue = true then
    e.datarow.Locked = true
end if


--  作者:zyys2813
--  发布时间:2014/1/6 21:29:00
--  
太感谢您了