
Code AardioLine:138复制
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.96.97.98.99.100.101.102.103.104.105.106.107.108.109.110.111.112.113.114.115.116.117.118.119.120.121.122.123.124.125.126.127.128.129.130.131.132.133.134.135.136.137.138.import
win
.ui;var
winform = win
.form(text="通用数据表维护"
;right=617
;bottom=427
;bgcolor=15780518
)- winform.add(
- buttonAdd={cls=
"button"
;text="增加空行"
;left=469
;top=40
;right=564
;bottom=80
;flat=1
;z=2
}; - buttonDel={cls=
"button"
;text="选择删除"
;left=469
;top=240
;right=564
;bottom=280
;flat=1
;z=3
}; - buttonDown={cls=
"button"
;text="选择下移"
;left=469
;top=190
;right=564
;bottom=230
;flat=1
;z=11
}; - buttonEdit={cls=
"button"
;text="双击修改"
;left=469
;top=90
;right=564
;bottom=130
;disabled=1
;flat=1
;z=12
}; - buttonSave={cls=
"button"
;text="保存"
;left=469
;top=290
;right=564
;bottom=330
;flat=1
;z=4
}; - buttonUp={cls=
"button"
;text="选择上移"
;left=469
;top=140
;right=564
;bottom=180
;flat=1
;z=10
}; - comboboxFile={cls=
"combobox"
;left=135
;top=349
;right=395
;bottom=370
;edge=1
;items={};mode="dropdown"
;z=8
}; - comboboxMenu={cls=
"combobox"
;left=136
;top=378
;right=272
;bottom=399
;edge=1
;items={};mode="dropdown"
;z=6
}; - listbox={cls=
"listbox"
;left=52
;top=39
;right=455
;bottom=340
;ah=1
;aw=1
;border=1
;dt=1
;items={};msel=1
;vscroll=1
;z=1
}; - static={cls=
"static"
;text="通用数据表维护"
;left=53
;top=6
;right=204
;bottom=29
;color=32768
;dt=1
;font=LOGFONT(h=-19
;name='微软雅黑'
;weight=700
);transparent=1
;z=5
}; - staticFile={cls=
"static"
;text="请选择文件"
;left=53
;top=353
;right=127
;bottom=375
;transparent=1
;z=9
}; - staticKey={cls=
"static"
;text="请选择类型"
;left=54
;top=382
;right=128
;bottom=404
;transparent=1
;z=7
} - )
import
console;import
fsys;import
win
.ui.listEdit;var
listEdit = win
.ui.listEdit(winform.listbox);- homeDir =
io
.fullpath("."
); - winform.path = homeDir;
if
_STUDIO_INVOKED winform.path = "D:\1_aardio"
; - menuFile,menuTab,fileType =
null
,null
; - winform.configPath = winform.path++
"\config"
; var
fileList,dirList = fsys.list(winform.configPath,,{"*.*"
});for
(i=1
;- winform.comboboxFile.add(fileList[fileList[i]]);
- }
- winform.comboboxFile.selIndex =
1
; - menuTab =
eval
(string
.load(fileList[fileList[1
]])); - winform.comboboxMenu.clear();
for
k,v in
menuTab{- winform.comboboxMenu.add(k);
- }
- winform.comboboxFile.onOk =
function
(){ -
if
! - menuFile = winform.comboboxFile.selText
- menuTab =
eval
(string
.load(menuFile)); - winform.comboboxMenu.clear();
-
for
k,v in
menuTab{ - winform.comboboxMenu.add(k);
- }
- }
- winform.comboboxMenu.onOk =
function
(){ -
if
! - fileType = winform.comboboxMenu.selText
-
if
type
(menuTab[fileType])="table"
winform.listbox.items = menuTab[fileType]; - }
- winform.listbox.onSelChange =
function
(){ -
if
!winform.listbox.selText return
; - }
- winform.buttonAdd.oncommand =
function
(id,event){ -
if
! - winform.listbox.add(
"-"
); - winform.listbox.update();
-
table
.push(menuTab[fileType],"-"
); - winform.listbox.ensureVisible(
-
- }
- winform.lineMove =
function
(index,tmpPos){ -
var
text = menuTab[fileType][tmpPos] - menuTab[fileType][tmpPos] = menuTab[fileType][index]
- menuTab[fileType][index] = text;
- winform.listbox.items = menuTab[fileType];
- winform.listbox.setSelected(tmpPos);
- }
- winform.buttonUp.oncommand =
function
(id,event){ -
if
! - index = winform.listbox.selIndex;
-
if
index>1
winform.lineMove(index,index-1
) - winform.listbox.ensureVisible();
- }
- winform.buttonDown.oncommand =
function
(id,event){ -
if
! - index = winform.listbox.selIndex;
-
if
index< - winform.listbox.ensureVisible();
- }
- winform.buttonDel.oncommand =
function
(id,event){ -
if
! -
for
(i= -
if
(winform.listbox.getSelected(i)){ - winform.listbox.delete(i)
-
- menuTab[fileType] = winform.listbox.items;
- }
- }
- }
- winform.listbox.onSelChange =
function
(){ - menuTab[fileType] = winform.listbox.items;
- }
- winform.saveFile =
function
(){ -
if
! - menuTab[fileType] = winform.listbox.items;
-
string
.save(menuFile,table
.tostring
(menuTab)); - winform.msgbox(
"完成"
) - }
- winform.buttonSave.oncommand =
function
(id,event){ - winform.saveFile()
- }
- winform.show();
win
.loopMessage();