懒人精灵(一款类似按键精灵的工具) 界面的加载,点击,关闭事件以及控件动态获取或者设置属性
下面是整个流程如果有什么不懂可以加群785554238,里面有最新的版本和相关最新的脚本例子以及插件1.如果没有安装先从此处下载安装包 https://share.weiyun.com/chGtVAd2 密码:ha99bi,或者直接进群下载最新版本2.懒人精灵新版新增了窗口的加载,以及按钮点击事件,关闭事件,以及对ui可动态获取或者其属性值,下面直接先上图1.点击第一个按钮,出现下面界面2.点击第
下面是整个流程如果有什么不懂可以加群785554238,里面有最新的版本和相关最新的脚本例子以及插件
2.懒人精灵新版新增了窗口的加载,以及按钮点击事件,关闭事件,以及对ui可动态获取或者其属性值,下面直接先上效果图,然后上代码
1.点击第一个按钮,出现下面界面
2.点击第二个按钮出现下面界面
3.点击第三个按钮出现下面界面
2.下面是窗口属性的设置界面
点击第一个按钮会禁用多选框如下图
点击第二个按钮会隐藏单选框,如下图
点击第三个按钮会在输入框中自动输入你想输入的内容,如下图
下面是代码部分,整个例子工程可以直接在群里下载
function getWinSize()
local w,h = getDisplaySize()
local wid = w
if wid > h then
wid = h
end
wid = wid * 0.8
return wid,wid
end
local w,h = getWinSize()
function showMsgBox(text)
showUI("MsgBoxWnd.ui",w * 2 / 3,h / 2,function(hWnd)
setLableText(hWnd,"idtext",text)
end,nil,nil)
end
function showInputBox()
showUI("InputWnd.ui",w * 2 / 3,h / 2,nil,function(hWnd,id)
if id == "idOk" then
local text = getEditText(hWnd,"idEdit1")
toast("你输入的内容是:"..text,0,0,30)
closeWindow(hWnd,true)
end
end,nil)
end
function showEmptyWnd()
showUI("EmptyWnd.ui",w,h,nil,function(hWnd,id)
if id == "idClose" then
closeWindow(hWnd,true)
end
end,nil)
end
function onClickEvent(handle,id) --窗口中按钮点击会响应该事件
if id == "IdopenEmptyWnd" then
showEmptyWnd()
elseif id == "IdopenInputWnd" then
showInputBox()
elseif id == "IdopenMsgBox" then
showMsgBox("你好朋友")
elseif id == "IdopenMsgBox" then
showMsgBox("你好朋友")
elseif id == "IdDisableCheck" then
setViewEnable(handle,"idCheckbox",false)
elseif id == "IdShowHideRadio" then
local v = getViewVisible(handle,"idRadiobox")
if v == 0 then
setViewVisible(handle,"idRadiobox",8)
else
setViewVisible(handle,"idRadiobox",0)
end
elseif id == "IdInputText" then
setEditText(handle,"idEdit1","你好朋友")
end
end
function onLoadEvent(handle) --窗口加载完成会响应该事件
toast("窗口加载完成",0,0,30)
end
function onCloseEvent(handle) --窗口关闭会响应该事件
toast("窗口被摧毁",0,0,30)
end
showUI("MainWnd.ui",w,h,onLoadEvent,onClickEvent,onCloseEvent)
sleep(100000) --等待退出
更多推荐
所有评论(0)