横板导航窗口里的plus按钮错位问题求助

ximenxiaochui 2月前 289

其实就是一个普通的横板导航窗口程序


单独运行first.aardio,plus按钮位置显示很正常:

但是一旦运行main.aardio,plus按钮显示就错位了:


first.aardio源码:

import fonts.fontAwesome;
import win.ui;
import fsys.dlg.dir;

/*DSG{{*/
var winform = win.form(text="设置";right=984;bottom=589;bgcolor=16777215)
winform.add(
settingBranchesPlus={cls="plus";text="设置";left=63;top=72;right=305;bottom=103;align="left";color=32768;db=1;dl=1;font=LOGFONT(h=-16);iconColor=2960685;iconStyle={align="left";font=LOGFONT(h=-19;name='FontAwesome')};iconText='\uF126';textPadding={left=30};z=1}
)
/*}}*/

import style;


var baseBranchesList={}

baseBranchesList[1]={"name"="test1","path"=""}
baseBranchesList[2]={"name"="test2","path"=""}
baseBranchesList[3]={"name"="test3","path"=""}

initTop=131;
initBottom=154;
curIndex=1;

for k,v in baseBranchesList{
	initTop=initTop+((curIndex-1)>0?1:0)*50;
	initBottom=initBottom+((curIndex-1)>0?1:0)*50;

	winform.add(
            		[  "baseBranchesLabel" + curIndex ] = {
                		cls="static";text=v["name"]+":";left=104;top=initTop;right=206;bottom=initBottom;z=4;color=8388608;bgcolor=16777215;font=LOGFONT(h=-14);
                		oncommand = function(id,event){
                    		
                		}
            		};
        		);
	winform.add(
            		[  "baseBranchesEdit" + curIndex ] = {
                		cls="edit";text=v["path"];left=209;top=initTop;right=636;bottom=initBottom;z=4;font=LOGFONT(h=-14);edge=1;multiline=1;
                		oncommand = function(id,event){
                    		
                		}
            		};
        		);
        		
	winform.add(
            		[  "baseBranchesButton" + curIndex ] = {
                		cls="plus";text='\uF115';left=649;top=initTop;right=689;bottom=initBottom;bgcolor=11580047;db=1;dr=1;font=LOGFONT(h=-16;name='FontAwesome');notify=1;tabstop=1;z=4;
                		oncommand = function(id,event){
                    		winform.settingBaseBranches(curIndex,v["name"],v["path"]);
                		}
            		};
        		);
        			
    winform["baseBranchesButton" + curIndex].skin(style.button)			

	curIndex++;
}

//选择文件夹路径,并保存
winform.settingBaseBranches=function(index,name,path){
	var selectedFolder = fsys.dlg.dir(,winform,'请选择要添加的目录:'+index)
	if(selectedFolder){
		winform["baseBranchesEdit"+index].text = selectedFolder;
	}
}



winform.show();
win.loopMessage();
return winform;


百思不得其解,求大佬解惑


ps:工程源码见附件


上传的附件:
最新回复 (2)
  • 光庆 2月前
    0 2

    把位置不正确的组件进行这样设置:

    修改后代码如下:

    import fonts.fontAwesome;
    import win.ui;
    import fsys.dlg.dir;
    /*DSG{{*/
    var winform = win.form(text="设置";right=984;bottom=589;bgcolor=16777215)
    winform.add(
    settingBranchesPlus={cls="plus";text="设置";left=63;top=72;right=305;bottom=103;align="left";color=32768;dl=1;dt=1;font=LOGFONT(h=-16);iconColor=2960685;iconStyle={align="left";font=LOGFONT(h=-19;name='FontAwesome')};iconText='\uF126';textPadding={left=30};z=1}
    )
    /*}}*/
    
    import style;
    
    
    var baseBranchesList={}
    
    baseBranchesList[1]={"name"="test1","path"=""}
    baseBranchesList[2]={"name"="test2","path"=""}
    baseBranchesList[3]={"name"="test3","path"=""}
    
    initTop=131;
    initBottom=154;
    curIndex=1;
    
    for k,v in baseBranchesList{
    	initTop=initTop+((curIndex-1)>0?1:0)*50;
    	initBottom=initBottom+((curIndex-1)>0?1:0)*50;
    
    	winform.add(
                		[  "baseBranchesLabel" + curIndex ] = {
                    		cls="static";text=v["name"]+":";left=104;top=initTop;dl=1;dt=1;right=206;bottom=initBottom;z=4;color=8388608;bgcolor=16777215;font=LOGFONT(h=-14);
                    		oncommand = function(id,event){
                        		
                    		}
                		};
            		);
    	winform.add(
                		[  "baseBranchesEdit" + curIndex ] = {
                    		cls="edit";text=v["path"];left=209;top=initTop;right=636;dl=1;dt=1;bottom=initBottom;z=4;font=LOGFONT(h=-14);edge=1;multiline=1;
                    		oncommand = function(id,event){
                        		
                    		}
                		};
            		);
            		
    	winform.add(
                		[  "baseBranchesButton" + curIndex ] = {
                    		cls="plus";text='\uF115';left=649;top=initTop;right=689;dl=1;dt=1;bottom=initBottom;bgcolor=11580047;font=LOGFONT(h=-16;name='FontAwesome');notify=1;tabstop=1;z=4;
                    		oncommand = function(id,event){
                        		winform.settingBaseBranches(curIndex,v["name"],v["path"]);
                    		}
                		};
            		);
            			
        winform["baseBranchesButton" + curIndex].skin(style.button)			
    
    	curIndex++;
    }
    
    //选择文件夹路径,并保存
    winform.settingBaseBranches=function(index,name,path){
    	var selectedFolder = fsys.dlg.dir(,winform,'请选择要添加的目录:'+index)
    	if(selectedFolder){
    		winform["baseBranchesEdit"+index].text = selectedFolder;
    	}
    }
    
    
    
    winform.show();
    win.loopMessage();
    return winform;


  • ximenxiaochui 2月前
    0 3
    学到了,庆帝威武~
返回