涉及框架的设置项统一应用,不再细分时机

修改errData的获得方式
WIDGET新增setOnChange方法,不再依赖THEME
This commit is contained in:
MrZ626
2021-12-16 12:39:42 +08:00
parent 8e075adf8f
commit 9c8c9f2106
10 changed files with 120 additions and 103 deletions

View File

@@ -45,7 +45,12 @@ local function _rectangleStencil()
gc.rectangle('fill',1,1,STW-2,STH-2)
end
local onChange=NULL
local WIDGET={}
function WIDGET.setOnChange(func)onChange=assert(type(func)=='function'and func,"WIDGET.setOnChange(func): func must be a function")end
local widgetMetatable={
__tostring=function(self)
return self:getInfo()
@@ -1263,7 +1268,7 @@ end
function listBox:getInfo()
return("x=%d,y=%d,w=%d,h=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
end
function WIDGET.newListBox(D)--name,x,y,w,h,lineH[,hideF][,hide][,drawF]
function WIDGET.newListBox(D)--name,x,y,w,h,lineH,drawF[,hideF][,hide]
local _={
name= D.name or"_",
@@ -1320,16 +1325,7 @@ function WIDGET.setWidgetList(list)
for i=1,#list do
list[i]:reset()
end
if SCN.cur~='custom_field'then
local colorList=THEME.getThemeColor()
if not colorList then return end
local rnd=math.random
for _,W in next,list do
if W.color and not W.fText then
W.color=colorList[rnd(#colorList)]
end
end
end
onChange()
end
end
function WIDGET.setScrollHeight(height)