forked from len0rd/rockbox
lua submenus add a way to dynamically add items
updated example script and renamed some functions as well fixed bug in printtable cursor position if greater than maxlines for the screen would reset to item 1 now we move the list start and select it (and try to center it on the screen) fixed a few bugs in the add_menu code Change-Id: I01dead0481ef2e925af8b4cc6c14e36c2859dbba
This commit is contained in:
parent
48b77898dc
commit
20cd89908d
3 changed files with 139 additions and 50 deletions
|
@ -336,6 +336,16 @@ function print_table(t, t_count, settings)
|
|||
|
||||
table_p = init_position(15, 5)
|
||||
line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2)
|
||||
|
||||
if curpos > maxline then
|
||||
local c = maxline / 2
|
||||
start = (start or 1) + curpos - maxline
|
||||
curpos = maxline
|
||||
while start + maxline <= t_count and curpos > c do
|
||||
curpos = curpos - 1
|
||||
start = start + 1
|
||||
end
|
||||
end
|
||||
maxline = math.min(maxline, t_count)
|
||||
|
||||
-- allow user to start at a position other than the beginning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue