import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
button={cls="button";text="button";left=344;top=415;right=702;bottom=446;z=2};
richedit={cls="richedit";text="richedit";left=48;top=67;right=711;bottom=373;edge=1;multiline=1;z=1}
)
/*}}*/
import crypt.bin
import console
import string.builder;
winform.button.oncommand = function(id,event){
var bs = string.builder()
var str=string.loadBuffer("/res/test.jpg");
restr=string.replace(crypt.bin.encodeHex(str)," ","")
bs.append("{\rtf1 {\pict\jpegblip0")
bs.append(restr)
bs.append("}}");
var ok=string.save("/res/tmp.rtf",tostring(bs))
while(ok){
var file = io.open(io.fullpath("/res/tmp.rtf"),"r+b");
winform.richedit.streamIn( ,function(format,buf,len){
return 0,file.readBuffer(buf,len):0;
} )
file.close()
break ;
}
}
winform.show()
win.loopMessage();