VFP导航按钮是否可用

作者在 2022-04-04 17:01:07 发布以下内容
* 导航按钮是否可用
DO CASE 
    CASE BETWEEN(RECCOUNT(),0,1) && 记录数为0或1 
        ThisForm.Command1.Enabled = .F. 
        ThisForm.Command2.Enabled = .F. 
        ThisForm.Command3.Enabled = .F. 
        ThisForm.Command4.Enabled = .F. 
    CASE RECCOUNT()>1 AND RECNO()=1 && 在第一条记录
        ThisForm.Command1.Enabled = .F. 
        ThisForm.Command2.Enabled = .F. 
        ThisForm.Command3.Enabled = .T. 
        ThisForm.Command4.Enabled = .T. 
    CASE RECCOUNT()>1 AND BETWEEN(RECNO(),2,RECCOUNT()-1) && 在第2条记录与倒数第2条记录之间
        ThisForm.Command1.Enabled = .T. 
        ThisForm.Command2.Enabled = .T. 
        ThisForm.Command3.Enabled = .T. 
        ThisForm.Command4.Enabled = .T. 
    CASE RECCOUNT()>1 AND RECNO()=RECCOUNT() && 在最后一条记录
        ThisForm.Command1.Enabled = .T. 
        ThisForm.Command2.Enabled = .T. 
        ThisForm.Command3.Enabled = .F. 
        ThisForm.Command4.Enabled = .F. 
ENDCASE
cWz=IIF(RECCOUNT()=0,"无记录",TRANSFORM(RECNO()) + "/" + TRANSFORM(RECCOUNT())) 
ThisForm.Label1.Caption = "目前记录位置:" + cWz
ThisForm.Refresh 
表单(Form)问题 | 阅读 524 次
文章评论,共0条
游客请输入验证码
浏览403471次