2010年9月19日

发几个常用窗口代码,需要的可以取用3

8.下拉选项optionMenu要配合menuItem一起来用,这个和window中menuItem道理是一样的;

global proc nrCreateYaoTestWindow()
{
    string $nrWindowName = "YaoTestWindow";
 
    if(`window -exists $nrWindowName`)
        deleteUI $nrWindowName;
 
    if(`windowPref -exists $nrWindowName`)
        windowPref -remove $nrWindowName;
 
    $nrWindowName = `window -t "YaoTestWindow" 
        -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
        -mnc ""
        -rc "" 
        $nrWindowName`;
 
        string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`;
            string $newObject2 = `optionMenu -en 1 -w 107 -h 24 -l "火星时代" optionMenu12`;
                menuItem -l "教学";
                menuItem -l "网站";
                menuItem -l "图书";
            optionMenu -e -sl 2 $newObject2;
            formLayout -e -attachPosition $newObject2 "top" 12 0 -attachPosition $newObject2 "left" 13 0 $newObject1;
        setParent ..;
    showWindow $nrWindowName;
}
nrCreateYaoTestWindow;

9.数据滑条下面脚本中的floatSliderGrp是浮点形式,整数型用indSliderGrp;
global proc nrCreateYaoTestWindow()
{
    string $nrWindowName = "YaoTestWindow";
 
    if(`window -exists $nrWindowName`)
        deleteUI $nrWindowName;
 
    if(`windowPref -exists $nrWindowName`)
        windowPref -remove $nrWindowName;
 
    $nrWindowName = `window -t "YaoTestWindow" 
        -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
        -mnc ""
        -rc "" 
        $nrWindowName`;
 
        string $newObject1 = `formLayout -en 1 -w 262 -h 354 -nd 100 formLayout91`;
            string $newObject2 = `floatSliderGrp -en 1 -w 240 -h 22 -f 1 -min 0 -max 100 -fmn 0 -fmx 100 -s 1 -fs 0.1 -ss 1 -v 0 -dc "" floatSliderGrp1`;
            formLayout -e -attachPosition $newObject2 "top" 16 0 -attachPosition $newObject2 "left" 18 0 $newObject1;
        setParent ..;
    showWindow $nrWindowName;
}
nrCreateYaoTestWindow;


10.分割线主要是separator语法,菜单中也可以用;
global proc nrCreateYaoTestWindow()
{
    string $nrWindowName = "YaoTestWindow";
 
    if(`window -exists $nrWindowName`)
        deleteUI $nrWindowName;
 
    if(`windowPref -exists $nrWindowName`)
        windowPref -remove $nrWindowName;
 
    $nrWindowName = `window -t "YaoTestWindow" 
        -s 1 -tb 1 -mnb 1 -mxb 1 -mb 0 -mbv 0 -tlb 0 -rtf 1
        -mnc ""
        -rc "" 
        $nrWindowName`;
 
        string $newObject1 = `formLayout -en 1 -w 374 -h 389 -nd 100 formLayout91`;
            string $newObject2 = `text -en 1 -w 32 -h 16 -l "文本1" -al "left" -fn "plainLabelFont" -rs 1 text2`;
            formLayout -e -attachPosition $newObject2 "top" 56 0 -attachPosition $newObject2 "left" 57 0 $newObject1;
            string $newObject3 = `separator -en 1 -w 300 -h 5 -st "out" -hr 1 separator6`;
            formLayout -e -attachPosition $newObject3 "top" 77 0 -attachPosition $newObject3 "left" 40 0 $newObject1;
            string $newObject4 = `text -en 1 -w 32 -h 16 -l "文本2" -al "left" -fn "plainLabelFont" -rs 1 text3`;
            formLayout -e -attachPosition $newObject4 "top" 89 0 -attachPosition $newObject4 "left" 57 0 $newObject1;
        setParent ..;
    showWindow $nrWindowName;
}
nrCreateYaoTestWindow;





沒有留言:

張貼留言