Hey,
If I have a timer that updates GUI after 4 seconds.
And I update GUI manually after 2 seconds (means 2 more seconds until timer updates it), can I 'restart' the timer? if so, then how? _________________
I'm rusty and getting older, help me re-learn lua.
CEEdit1 is used to filter out other items, those which doesn't match.
Because I didn't want another "OK" button, I called fillList function inside CEEdit1Change. This fillList function clears ListBox and then fills it again. It has one unpleasant effect: for every typed letter ListBox is refreshed. Sometimes those calls are stacked (user already typed in whole word very fast and list still will blink one or two times).
I resolved this problem by using timer:
Code:
if filterDelayTimer ~= nil then filterDelayTimer.destroy(); filterDelayTimer=nil end
filterDelayTimer = createTimer(nil,false)
filterDelayTimer.Interval = 500
filterDelayTimer.OnTimer =
function (t) t.Enabled=false; fillList(UDF1.CEListBox1,filteredTable) end
function CEEdit1Change(sender)
if itemsTable==nil then return end
filteredTable = {}
local filter = UDF1.CEEdit1.Text
for i,v in ipairs(itemsTable) do
if v.name:upper():match(filter:upper()) then
filteredTable[#filteredTable+1] = v
end
end
The above is exactly "set Enabled to false and then back to true again". ListBox is refreshed with 500ms delay. I left only visual thing which is immediately refreshed: ShownItemsLabel _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum