Module ui.widget.listview

Widget component that handles pagination for a list of items.

Example:

local list_view = ListView:new{
    height = Screen:scaleBySize(400),
    width = Screen:scaleBySize(200),
    page_update_cb = function(curr_page_num, total_pages)
        -- This callback function will be called whenever a page
        -- turn event is triggered. You can use it to update
        -- information on the parent widget.
    end,
    items = {
        FrameContainer:new{
            bordersize = 0,
            background = Blitbuffer.COLOR_WHITE,
            TextWidget:new{
                text = "foo",
                face = Font:getFace("cfont"),
            }
        },
        FrameContainer:new{
            bordersize = 0,
            background = Blitbuffer.COLOR_LIGHT_GRAY,
            TextWidget:new{
                text = "bar",
                face = Font:getFace("cfont"),
            }
        },
        -- You can add as many widgets as you want here...
    }
}

Note that ListView is created mainly to be used as a building block for other widgets like NetworkSetting, so they can share the same pagination code.



generated by LDoc 1.5.0 Last updated 2024-12-19 07:44:17