注册 登录
编程论坛 VFP论坛

这是我自学时教材上,一个复选框的Click事件代码,烦请哪位高手帮我逐句注释一下,我看不懂

hszxgb 发布于 2020-10-21 18:39, 2209 次点击
WITH thisform.grd运动项目
    .readonly=! this.Value
    .allowaddnew=this.Value
    .deletemark=this.Value
    .parent.cmd追加.enabled=this.Value
 endwith
10 回复
#2
吹水佬2020-10-21 19:20
帮助文件查看下那几个属性就可以
#3
hszxgb2020-10-21 20:12
回复 2楼 吹水佬
主要是不懂with.....endwith 这个具体什么含义,语法等
vfp9.0的帮助文件中还没有这个,找不到
#4
吹水佬2020-10-21 20:33
以下是引用hszxgb在2020-10-21 20:12:11的发言:

主要是不懂with.....endwith 这个具体什么含义,语法等
vfp9.0的帮助文件中还没有这个,找不到

只有本站会员才能查看附件,请 登录
#5
hszxgb2020-10-22 07:54
回复 4楼 吹水佬
好的,我看看
#6
hszxgb2020-10-22 08:20
回复 4楼 吹水佬
还是没有理解过来,这个复选框这样设置,对表格控件怎么实现控制的,表格控件那几个属性本来就设置可以用户修改,特别是.readonly=! this value,让人费解,高手就麻烦你给这几个做个注释如何?一个问题卡壳,学习无法进行下去啊!
#7
wangzhiyi2020-10-22 08:33
.readonly=! this value表示取控件的非值 ,比如说控件是勾选状态(逻辑真.T.),则这个控件变为只读状态,类似键盘的双态键(大小写锁定键)。
#8
gs25367856782020-10-22 09:43
WITH thisform.grd运动项目
    .readonly=! this.Value
    .allowaddnew=this.Value
    .deletemark=this.Value
    .parent.cmd追加.enabled=this.Value
 endwith

相当于
thisform.grd运动项目.readonly=! this.Value
thisform.grd运动项目.allowaddnew=this.Value
thisform.grd运动项目.deletemark=this.Value
thisform.grd运动项目.parent.cmd追加.enabled=this.Value
#9
hszxgb2020-10-22 10:53
回复 8楼 gs2536785678
代码中的this.value,是指我原来设置的表格控件相关属性的值呢?还是从这个复选框相应的属性值重新给表格控件赋值。
总算看懂了!谢谢大家!!!

[此贴子已经被作者于2020-10-22 10:58编辑过]

#10
hszxgb2020-10-22 11:19
回复 8楼 gs2536785678
为什么这个复选框代码不这样写?这样写可以吗?高手给个建议
if this.value=1             &&如果复选框被选中
   WITH thisform.grd运动项目      &&对表格控件各个属性赋值如下
     .readonly=! this.Value
     .allowaddnew=this.Value
     .deletemark=this.Value
     .parent.cmd追加.enabled=this.Value
   endwith
else                     &&如果复选框未被选中
   WITH thisform.grd运动项目       &&对表格控件各个属性赋值如下   
     .readonly=this.Value
     .allowaddnew=! this.Value
     .deletemark=! this.Value
     .parent.cmd追加.enabled=! this.Value
   endwith
endif


[此贴子已经被作者于2020-10-23 15:00编辑过]

#11
hszxgb2020-10-28 23:05
回复 2楼 吹水佬
好的
1