富文本编辑器自动加行号

admin2021-12-28  1K+

import win.ui;
import console;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469;edge=1)
winform.add(
listview={cls="listview";left=77;top=43;right=126;bottom=428;bgcolor=12632256;z=1};
richedit={cls="richedit";left=128;top=59;right=724;bottom=429;edge=1;multiline=1;z=2}
)
/*}}*/

//winform.listview.setTable({{行='1'};{行='2'};{行='3'};fields={'行'}})

winform.richedit.onChange = function(){ 
    var rows=winform.richedit.lineCount;
    var newRows={}
    
    for(i=1;rows;1){
        table.push(newRows,{行=tostring(i)});
    }
    newRows.fields={'行'};
    winform.listview.setTable(newRows);
    //console.dump(newRows)
    
}

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

 

简单实现了一下,谁有更好的办法

转载请注明原文地址: http://www.aardio.net/read-280.html
最新回复(0)
winform(win)
aardio winform(win)