37 lines
893 B
Plaintext
37 lines
893 B
Plaintext
import win.ui;
|
|
/*DSG{{*/
|
|
var winform = win.form(text="aardio form";right=759;bottom=469)
|
|
winform.add(
|
|
button={cls="button";text="Button";left=373;top=87;right=452;bottom=121;z=2};
|
|
button2={cls="button";text="Button";left=586;top=65;right=668;bottom=100;z=3};
|
|
custom={cls="\serial.aardio";text="自定义控件";left=49;top=45;right=396;bottom=363;z=1}
|
|
)
|
|
/*}}*/
|
|
|
|
import sio
|
|
import win.dlg.message;
|
|
|
|
import console
|
|
var cfg, comport;
|
|
winform.button.oncommand = function(id,event){
|
|
var ctrl = winform.custom;
|
|
cfg = winform.custom.getcfg()
|
|
console.dump(cfg)
|
|
comport,err = sio.port(cfg[1])
|
|
if(!comport){
|
|
return winform.msgErr(err);
|
|
}
|
|
sta,err = comport.ioctl(table.unpack(cfg,2))
|
|
if(!sta){
|
|
return winform.msgErr(err);
|
|
}
|
|
owner.text = "close"
|
|
}
|
|
|
|
winform.button2.oncommand = function(id,event){
|
|
var cfg = winform.custom.getcfg()
|
|
console.dump(cfg)
|
|
}
|
|
|
|
winform.show();
|
|
win.loopMessage(); |