示例1
- import win.ui;
- /*DSG{{*/
- var winform = ..win.form( bottom=399;parent=...;text="AAuto Form";right=599 )
- winform.add(
- listview={ bgcolor=16777215;bottom=291;right=520;left=21;top=46;z=1;gridLines=1;edge=1;cls="listview" };
- edit={ text="edit";bottom=363;right=431;left=82;top=337;z=2;edge=1;cls="edit" }
- )
- /*}}*/
- winform.listview.insertColumn("dfdfd",150)
- winform.listview.insertColumn("dfdfd",150)
- winform.listview.insertColumn("dfdfd",-1)
- winform.listview.addItem({"sdfsdf";'sdfd645';'fkdl'})
// 插入控件
- winform.listview.addCtrl(
- btn = {
- cls="button";left=0;top=0;right=50;bottom=50;autoResize=false ;edge=1;
- oncommand=function(id,event){
- winform.msgboxTest(winform.edit.text)
- }
- }
- )
//winform.cmdTranslate 转发命令消息,在父控件wndproc消息回调中调用,用于启用子控件的oncommand事件.
- winform.listview.wndproc = function(hwnd,message,wParam,lParam){
- winform.cmdTranslate(hwnd,message,wParam,lParam);
- }
// 设置内嵌控件的位置
- var rc = winform.listview.getItemRect(1,3,,2)
- winform.listview.btn.setRect(rc)
- winform.show()
- win.loopMessage();
- import win.ui;
- /*DSG{{*/
- var winform = ..win.form( bottom=356;parent=...;text="AAuto Form";right=351 )
- winform.add(
- listview={ bgcolor=16777215;bottom=296;right=309;left=37;top=41;z=1;edge=1;cls="listview" }
- )
- /*}}*/
- winform.listview.addCtrl(
- btn1 ={ cls="button";left=0;top=0;right=50;bottom=50;autoResize=false ;hide=1;edge=1;hide=0;text="btn1";id=100;z=1 };
- btn2 ={ cls="button";left=0;top=52;right=50;bottom=102;autoResize=false ;hide=1;edge=1;hide=0;text="btn2";id=101;z=2 };
- btn3 ={ cls="button";left=0;top=104;right=50;bottom=154;autoResize=false ;hide=1;edge=1;hide=0;text="btn3";id=102;z=3 };
- btn4 ={ cls="button";left=0;top=156;right=50;bottom=206;autoResize=false ;hide=1;edge=1;hide=0;text="btn4";id=103;z=4 };
- )
- winform.listview.wndproc = function(hwnd, message, wParam, lParam) {
- winform.cmdTranslate(hwnd, message, wParam, lParam);
- }
- winform.listview.btn1.oncommand = function () {
- winform.msgbox("我是 btn1");
- }
- winform.listview.btn2.oncommand = function () {
- winform.msgbox("我是 btn2");
- }
- winform.show()
- win.loopMessage();