| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2029 人关注过本帖
标题:还是改成容器吧,编程的时候好处理一点
取消只看楼主 加入收藏
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
结帖率:91.53%
收藏
已结贴  问题点数:100 回复次数:6 
还是改成容器吧,编程的时候好处理一点
程序代码:
    PROCEDURE howManyLine.upClick &&rtnMainBtn.click
        IF thisform.currLine<4
            clflCbxNum="clflCbx"+ALLTRIM(STR(thisform.howManyLine.value))
            clmcCbxNum="clmcCbx"+ALLTRIM(STR(thisform.howManyLine.value))
            jldwCbxNum="jldwCbx"+ALLTRIM(STR(thisform.howManyLine.value))
            ssslTxtNum="ssslTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            grdjTxtNum="grdjTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            grjeTxtNum="grjeTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            bzdjTxtNum="bzdjTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            bzjeTxtNum="bzjeTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            cjTxtNum="cjTxt"+ALLTRIM(STR(thisform.howManyLine.value))
            bgddCbxNum="bgddCbx"+ALLTRIM(STR(thisform.howManyLine.value))
           
            thisform.addobject('&clflCbxNum','comboBox')
            thisform.addobject('&clmcCbxNum','comboBox')
            thisform.addobject('&jldwCbxNum','comboBox')
            thisform.addobject('&ssslTxtNum','textBox')
            thisform.addobject('&grdjTxtNum','textBox')
            thisform.addobject('&grjeTxtNum','textBox')
            thisform.addobject('&bzdjTxtNum','textBox')
            thisform.addobject('&bzjeTxtNum','textBox')
            thisform.addobject('&cjTxtNum','textBox')
            thisform.addobject('&bgddCbxNum','comboBox')
           
            Thisform.Arrange
        ELSE
            MESSAGEBOX("1单内最多只能有4项材料入账",64,"操作提示!")       
        ENDIF
    ENDPROC 

    PROCEDURE howManyLine.downClick &&rtnMainBtn.click
        IF thisform.currLine>1
            clflCbxNum="clflCbx"+ALLTRIM(STR(thisform.howManyLine.value+1))
            clmcCbxNum="clmcCbx"+ALLTRIM(STR(thisform.howManyLine.value+1))
            jldwCbxNum="jldwCbx"+ALLTRIM(STR(thisform.howManyLine.value+1))
            ssslTxtNum="ssslTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            grdjTxtNum="grdjTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            grjeTxtNum="grjeTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            bzdjTxtNum="bzdjTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            bzjeTxtNum="bzjeTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            cjTxtNum="cjTxt"+ALLTRIM(STR(thisform.howManyLine.value+1))
            bgddCbxNum="bgddCbx"+ALLTRIM(STR(thisform.howManyLine.value+1))

            thisform.removeObject('&clflCbxNum')
            thisform.removeObject('&clmcCbxNum')
            thisform.removeObject('&jldwCbxNum')
            thisform.removeObject('&ssslTxtNum')
            thisform.removeObject('&grdjTxtNum')
            thisform.removeObject('&grjeTxtNum')
            thisform.removeObject('&bzdjTxtNum')
            thisform.removeObject('&bzjeTxtNum')
            thisform.removeObject('&cjTxtNum')
            thisform.removeObject('&bgddCbxNum')
           
            Thisform.Arrange
        ELSE
            MESSAGEBOX("1单内至少要有1项材料入账",64,"操作提示!")       
        ENDIF
    ENDPROC 

一个一个的添加,是不是相应的数据关联,也要一个一个的做?好像是挺。。。。。。

现在换成容器,但是大脑里,对于容器内各控件间距,各控件命名和以后的引用,还有容器和表单上面和下面的控件间的定位,缩放、字号大小调整

所有概念都很模糊,T版说,这种时候,先用语言描述一遍逻辑,再把汉语换成编程语言。。。。。。

那我就说了 ,,,   不对的地方  各位老师指正一下
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
&&收料单
    略,,,
   
    添加第三条直线 with top=上一行控件的底+三倍行距
    添加容器a  with top=第三条直线的底+三倍行距,left=第三条直线的left,width=第三条直线的宽
    添加第四条直线 with top=容器a的底+三倍行距
    添加退出按钮等,在第四条直线下面

    略,,,

    procedure Arrange
        if type(第四行第一个控件)=="o"
            容器a的高=第三条直线的底+4行控件的高+三倍行距
        endif
        if type(第三行第一个控件)=="o"
            容器a的高=第三条直线的底+3行控件的高+两倍行距
        endif
        if type(第二行第一个控件)=="o"
            容器a的高=第三条直线的底+2行控件的高+一倍行距
        endif
        if type(第一行第一个控件)=="o"
            容器a的高=第三条直线的底+1行控件的高
        endif            
    endproc

    procedure init
        select 2    &&按表的建立顺序,每个表在固定工作区打开
        use datas\收料明细
        go top
        if bof()
            容器b.addobject('容器b1','容器')
            各种按钮状态的调节
        else
            查询最后一条收料明细的账单号,并根据它包含的项目数添加容器b的相应个数的实例
            各种按钮状态的调节
        endif
    endproc

&&收料容器.prg
具体内容还没想好怎么写 。。。



2016-01-01 16:03
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
SET PROCEDURE TO "MyGet" ADDITIVE
SET PROCEDURE TO "MyGrid" ADDITIVE

这两个   放上来    参考一下    谢谢

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-01 17:05
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
回复 5楼 TonyDeng
你这是打算活活急死我啊  大年初一  虽然是阳历   也不带你这样的啊   。。。

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-01 22:53
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
DEFINE CLASS m1Form as myForm
    showWindow=2
    caption="功能1——收料单"
    autoCenter=.t.
    windowType=1
    height=192
    width=540
    minWidth=this.Width
    minHeight=this.Height
    aspect=this.width/this.height        
    beforeWidth=this.width
    beforeHeight=this.Height
    formZoom=1
    currLine=1
    newLineTop=1    &&用于定义新容器的两个属性
    lastLineBottom=1

    ADD OBJECT howManyLine as spinner WITH spinnerHighValue=4,spinnerLowValue=1,value=1
    ADD OBJECT line3 as line WITH borderWidth=1,height=0
    ADD OBJECT line4 as line WITH borderWidth=1,height=0

    PROCEDURE Arrange
        WITH this.howManyLine
            .top=this.titleLabel.top+this.titleLabel.height/2-.height/2
            .left=this.howLineLabel.left+this.howLineLabel.width+3*this.formZoom
            .height=20*this.formZoom
            .width=.height*1.6
            .fontSize=this.howLineLabel.fontSize
        ENDWITH
        WITH this.line3
            .top=this.clflTitle.top+this.clflTitle.height+3*this.formZoom
            .left=12
            .width=this.width-.left*2
        ENDWITH        
        IF this.howManyLine.value==1
            this.newLineTop=this.line3.top+this.line3.borderWidth+3*this.formZoom
            thisform.lastLineBottom=thisform.newLineTop
        ENDIF
        WITH this.line4
            .top=thisform.lastLineBottom
            .left=12
            .width=this.width-.left*2
        ENDWITH
    PROCEDURE howManyLine.upClick &&rtnMainBtn.click
        IF thisform.currLine<4
                newLine="clmx"+ALLTRIM(STR(thisform.howManyLine.value))
                thisform.addobject('&newLine','shouliaoAddLine',;
                    thisform.bgddTitle.left+thisform.bgddTitle.width-thisform.clflTitle.left)
                WITH thisform.&newLine
                    .top=thisform.newLineTop
                    .left=thisform.clflTitle.left
                ENDWITH
            Thisform.Arrange
            thisform.newLineTop=thisform.&newLine..top+thisform.&newLine..height+3*thisform.formZoom
            thisform.lastLineBottom=thisform.newLineTop
        ELSE
            MESSAGEBOX("1单内最多只能有4项材料入账",64,"操作提示!")        
        ENDIF
    ENDPROC
enddefine
++++++++++++++++++++++
&&shouliaoContainer.prg

DEFINE CLASS shouliaoAddLine as Container
    backStyle=0
    borderWidth=0
    height=24
    myZoom=1
    aspect=this.width/this.height
    beforeWidth=1
   
    ADD OBJECT clflCbx as comboBox
    ADD OBJECT clmcCbx as comboBox
    ADD OBJECT jldwCbx as comboBox
    ADD OBJECT ssslTxt as textBox
    ADD OBJECT grdjTxt as textBox
    ADD OBJECT grjeTxt as textBox
    ADD OBJECT bzdjTxt as textBox
    ADD OBJECT bzjeTxt as textBox
    ADD OBJECT cjTxt as textBox
    ADD OBJECT cjCauseTxt as textBox
    ADD OBJECT bgddCbx as comboBox
   
    PROCEDURE Arrange
   
        IF this.width<>this.beforeWidth
            this.height=this.width/this.aspect
        ENDIF
        IF this.height<>this.beforeHeight
            this.width=this.height*this.aspect
        ENDIF
        this.myZoom=this.height/this.minHeight
        this.beforeHeight=this.height
        this.beforeWidth=this.width
   
        WITH this.clflCbx
            .top=1
            .left=1
            .height=24*this.myZoom
            .width=50*this.myZoom
        ENDWITH
        WITH this.clmcCbx
            .top=this.clflCbx.top
            .left=this.clflCbx.left+this.clflCbx.width+this.myZoom*3
            .height=24*this.myZoom
            .width=78*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.jldwCbx
            .top=this.clflCbx.top
            .left=this.clmcCbx.left+this.clmcCbx.width+this.myZoom*3
            .height=24*this.myZoom
            .width=48*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.ssslTxt
            .top=this.clflCbx.top
            .left=this.jldwCbx.left+this.jldwCbx.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.grdjTxt
            .top=this.clflCbx.top
            .left=this.ssslTxt.left+this.ssslTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.grjeTxt
            .top=this.clflCbx.top
            .left=this.grdjTxt.left+this.grdjTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.bzdjTxt
            .top=this.clflCbx.top
            .left=this.grjeTxt.left+this.grjeTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.bzjeTxt
            .top=this.clflCbx.top
            .left=this.bzdjTxt.left+this.bzdjTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.cjTxt
            .top=this.clflCbx.top
            .left=this.bzjeTxt.left+this.bzjeTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=26*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.cjyyTxt
            .top=this.clflCbx.top
            .left=this.cjTxt.left+this.cjTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=107*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        WITH this.bgddCbx
            .top=this.clflCbx.top
            .left=this.cjyyTxt.left+this.cjyyTxt.width+this.myZoom*3
            .height=24*this.myZoom
            .width=48*this.myZoom
            .fontSize=this.clflCbx.fontSize
        ENDWITH
        
        this.Height=this.bgddCbx.top+this.bgddCbx.height
        this.Width=this.bgddCbx.left+this.bgddCbx.width
    ENDPROC
   
    PROCEDURE activate
        this.arrange
    ENDPROC
   
    PROCEDURE resize
        this.arrange
    ENDPROC      
ENDDEFINE

+++++++++++++++++++++++++++++++++++++++++++++++

一、上面红色字   我想在创建容器的时候   把它的宽传到它的INIT里  怎么做啊?

二、新添加的容器   怎么添加一个新方法?比较它自己的arrange,然后把下面那段With放进去

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-02 15:26
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
ADD OBJECT outContainer as Container WITH backStyle=0,borderWidth=0

        WITH this.outContainer
            .top=this.line3.top+this.line3.borderWidth+3*this.formZoom
            .left=this.clflTitle.left
            .width=this.bgddTitle.left+this.bgddTitle.width-.left
            .height=(24*this.formZoom+3*this.formZoom)*this.howManyLine.value-1
        ENDWITH

        WITH this.line4
            .top=this.outContainer.top+this.outContainer.height
            .left=12
            .width=this.width-.left*2
        ENDWITH

               newLine="clmx"+ALLTRIM(STR(thisform.howManyLine.value))
                thisform.outContainer.addobject('&newLine','shouliaoAddLine')
                WITH thisform.outContainer.&newLine
                    .top=thisform.outContainer.top
                    .left=thisform.outContainer.left
                    .SetAll("Visible", .T.)
                ENDWITH


大圈套小圈的定位方法,控件还是不显示  已经SetAll了   。。。

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-02 15:56
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册


用容器类  是添加了  不过  这大小  不好控制啊   

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-02 17:16
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
回复 13楼 TonyDeng
LOCAL lnIndex
        This.Height = 0
        This.Width = 0
        FOR lnIndex = 1 TO This.ControlCount


3Q,我去研究一下

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2016-01-04 12:22
快速回复:还是改成容器吧,编程的时候好处理一点
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020788 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved