首页  »   VFP

VFP list 列表框

网友分享于:2013-08-22  浏览:35次
求助 VFP list 列表框
我想实现 类似于 表单向导 选择字段 中的功能,点击按钮 字段进入 到另外一个控件  
没法传图片 。大家给我点list列表框的 例子也行。
我找也找不到啊

------解决方案--------------------
SQL code

*---VFP6.0代码
FORM1=NEWOBJECT("Form_1")
FORM1.SHOW  &&显示表单
READ EVENTS && 开始事件处理
RETURN
DEFINE CLASS FORM_1 AS FORM
   AUTOCENTER=.T.
   BORDERSTYLE=2
   CAPTION="列表框(LISTBOX)示例一"
   *CLOSABLE=.F.
   DOCREATE=.T.
   HEIGHT=230
   MAXBUTTON=.F.
   MINBUTTON=.F.
   MOVABLE=.F.
   SHOWTIPS=.T.
   SHOWWINDOW=2
   WIDTH=275
   WINDOWTYPE=1
   ADD OBJECT LABEL1 AS LABEL WITH AUTOSIZE=.T.,CAPTION="可选字段",TOP=10,LEFT=18,HEIGHT=28,WIDTH=40,FONTSIZE=11
   ADD OBJECT LABEL2 AS LABEL WITH AUTOSIZE=.T.,CAPTION="已选字段",TOP=10,LEFT=182,HEIGHT=28,WIDTH=40,FONTSIZE=11
   ADD OBJECT LIST1  AS LISTBOX WITH TOP=30,LEFT=0,FONTSIZE=11
   ADD OBJECT LIST2  AS LISTBOX WITH TOP=30,LEFT=175,FONTSIZE=11
   ADD OBJECT COMMANDGROUP1 AS COMMANDGROUP WITH BUTTONCOUNT=4,LEFT=113,HEIGHT=THISFORM.LIST1.HEIGHT,TOP=30,WIDTH=51
   PROCEDURE INIT
      CSTR="张援朝王抗美李援越刘抗日赵时代"
      WITH THISFORM.LIST1
         FOR I=1 TO INT(LEN(CSTR)/6)
             .ADDITEM(SUBSTRC(CSTR,(I-1)*3+1,3))
         ENDFOR
         .MULTISELECT=.T. && 多重选择记录
      ENDWITH
      THISFORM.LIST2.MULTISELECT=.T. && 多重选择记录
   ENDPROC
   PROCEDURE COMMANDGROUP1.INIT
      WITH THISFORM.COMMANDGROUP1
        .VALUE=0
        WITH .COMMAND1
           .AUTOSIZE=.T.
           .CAPTION=CHR(97)
           .FONTNAME="WINGDINGS 3"
           .FONTSIZE=11
           .LEFT=5
           .TOP=5
           .TOOLTIPTEXT="右移记录"
        ENDWITH
        WITH .COMMAND2
           .AUTOSIZE=.T.
           .CAPTION=CHR(99)
           .FONTNAME="WINGDINGS 3"
           .FONTSIZE=11
           .LEFT=5
           .TOP=49
           .TOOLTIPTEXT="全部右移"
        ENDWITH
        WITH .COMMAND3
           .AUTOSIZE=.T.
           .CAPTION=CHR(96)
           .ENABLED=.F.
           .FONTNAME="WINGDINGS 3"
           .FONTSIZE=11
           .LEFT=5
           .TOP=91
           .TOOLTIPTEXT="左移记录"
        ENDWITH
        WITH .COMMAND4
           .AUTOSIZE=.T.
           .CAPTION=CHR(98)
           .ENABLED=.F.
           .FONTNAME="WINGDINGS 3"
           .FONTSIZE=11
           .LEFT=5
           .TOP=134
           .TOOLTIPTEXT="全部左移"
        ENDWITH

      ENDWITH
   ENDPROC
   PROCEDURE COMMANDGROUP1.CLICK
      WITH THISFORM
         DO CASE
            CASE .COMMANDGROUP1.VALUE=1 && 右移记录
                 FOR I=1 TO .LIST1.LISTCOUNT
                     IF .LIST1.SELECTED(I)
                        ZDM=.LIST1.LIST(I)
                        .LIST2.ADDITEM(ZDM)
                        .LIST1.REMOVEITEM(I)
                     ENDIF
                 ENDFOR
            CASE .COMMANDGROUP1.VALUE=2 && 记录全部右移
                  DO WHILE .LIST1.LISTCOUNT>0
                    .LIST2.ADDITEM(.LIST1.LIST(1))
                    .LIST1.REMOVEITEM(1)
                 ENDDO
            CASE .COMMANDGROUP1.VALUE=3 && 左移记录
                 FOR I=1 TO .LIST2.LISTCOUNT
                     IF .LIST2.SELECTED(I)
                        ZDM=.LIST2.LIST(I)
                        .LIST1.ADDITEM(ZDM)
                        .LIST2.REMOVEITEM(I)
                     ENDIF
                 ENDFOR
            CASE .COMMANDGROUP1.VALUE=4 && 记录全部左移
                 DO WHILE .LIST2.LISTCOUNT>0
                    .LIST1.ADDITEM(.LIST2.LIST(1))
                    .LIST2.REMOVEITEM(1)
                 ENDDO
         ENDCASE
         IF .LIST2.LISTCOUNT>0
            .COMMANDGROUP1.COMMAND3.ENABLED=.T.
            .COMMANDGROUP1.COMMAND4.ENABLED=.T.
         ELSE
            .COMMANDGROUP1.COMMAND3.ENABLED=.F.
            .COMMANDGROUP1.COMMAND4.ENABLED=.F.
         ENDIF
         IF .LIST1.LISTCOUNT=0
            .COMMANDGROUP1.COMMAND1.ENABLED=.F.
            .COMMANDGROUP1.COMMAND2.ENABLED=.F.
         ELSE
            .COMMANDGROUP1.COMMAND1.ENABLED=.T.
            .COMMANDGROUP1.COMMAND2.ENABLED=.T.
         ENDIF
         .REFRESH
      ENDWITH
   ENDPROC
   PROCEDURE DESTROY
      CLEAR EVENTS
   ENDPROC
ENDDEFINE
上一页1/2下一页

相关解决方案

最新解决方案