(转)Htmlayout实现不丢输入框焦点实现交互
By
笑口常开
at 2019-01-01 • 0人收藏 • 1446人看过
感谢:netfox(已认证) 提供源码,
收藏,学习先
import win.ui; /*DSG{{*/ var winform = win.form(text="文本框焦点";right=599;bottom=399;parent=...) winform.add() /*}}*/ import key import web.layout; var wbLayout = web.layout(winform); wbLayout.html = /********* <html> <head> <style> body { font:system; } div#container { flow:horizontal; border-spacing:20px; . width:*; height:*; } div#container > #report { width:*; height:300px; } tr:checked{ color:highlighttext; background:highlight; } </style> </head> <body> <br /> <span>input保留焦点,下拉列表上下键选择</span><br /> <br /> <input type="text" #filter> <div #container> <widget type="select" #report> <table border=1 width=100%% cellspacing=-1px> <!-- cell border collapsing hack--> <tr><th>标题字段</th><th>值</th></tr> <tr role="option" value=1> <td>小王</td> <td> 15521518548 </td> </tr> <tr role="option" value=2> <td>小张</td> <td>1712545158 </td> </tr> <tr role="option" value=3> <td>贝贝</td> <td>13755148548</td> </tr> <tr role="option" value=4> <td>燕子</td> <td>18254851858</td> </tr> <tr role="option" value=5> <td>蓝雪</td> <td>17425814751</td> </tr> <tr role="option" value=6> <td>大张</td> <td>1535151585</td> </tr> </table> </widget> </div> </body> </html> *********/ var index,rows = 0,wbLayout.$1("#report table").childCount()-1; var filter = wbLayout.$1("#filter") filter.onKeyDown = function (ltTarget,ltOwner,keyCode, altState, ltKeyParams) { select(keyCode) { case 0x28 { if index = rows index = 0; index++; wbLayout.$1("#report").value = index; } case 0x26{ index--; if index = 0 index = rows; wbLayout.$1("#report").value = index; } case 0xD { ele = wbLayout.$1("#report tr:checked") win.msgbox(ele.value) } } } filter.attachEventHandler() winform.show() win.loopMessage();
登录后方可回帖