Issue with scrolling a list with the hardware buttons

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue with scrolling a list with the hardware buttons

clfishcn
Hello,

I found an issue while scrolling a list with the hardware buttons
when the elements of the table that the list feeds from exceeds the
numbers of lines which makes up the list. What happens is that the
only the top two lines will scroll, while the remaining lines are not
refreshed.

We're talking plua latest beta (2.b8) on a palm T3.

Here's some code to show this:

list = gui.control{
 type="list",
 list=table,
 lines=6,
 columns=30
}

function scrollList(Id, Key)
 if list then
        local Pos = gui.getstate(list)
        local newPos
       
        local function refresh(Pos)
         if Pos <  1 then Pos = 1
         elseif Pos > table.getn(table) then Pos = table.getn(table)
         end
         gui.setstate(list, Pos)
        end
       
        if Key == hardKeyDown then
                newPos = Pos + 1
                refresh(newPos)
        elseif Key == hardKeyUp then
                 newPos = Pos - 1
                 refresh(newPos)
        end
 end
end


gui.sethandler(keyDown,scrollList)
gui.main()

That's it.

Daniel