输入框焦点事件

admin2021-03-01  158

import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469;parent=...)
winform.add(
edit={cls="edit";text="不填时,随机生成手机号!";left=202;top=170;right=396;bottom=196;edge=1;multiline=1;z=1};
edit2={cls="edit";text="切换光标";left=201;top=228;right=395;bottom=257;edge=1;multiline=1;z=2}
)
/*}}*/


winform.edit.wndproc = function(hwnd,message,wParam,lParam){
        if(message = 0x0008){//光标焦点离开
                if(winform.edit.text =""){
                        winform.edit.text = "不填时,随机生成手机号!"
                }
        }
        if(message=512){//鼠标进入控件区域
                if(winform.edit.text = "不填时,随机生成手机号!"){
                        winform.edit.text = ""
                }
        }
        if(message=675){//鼠标离开控件区域
                if(win.getFocus() != winform.edit.hwnd){
                        if(winform.edit.text = ""){
                                winform.edit.text = "不填时,随机生成手机号!"
                        }
                }
        }
}

winform.enableDpiScaling();
winform.show();

win.loopMessage();
return winform;
转载请注明原文地址: https://www.aardio.net/read-156.html
最新回复(0)