#!/usr/bin/env lua5.1 require [[fp]] require [[fptheme]] require [[fpwidgets]] -- Width and height of an entry. EWIDTH = 200 EHEIGHT = 56 -- Width and height of the scrollable area when in -- portrait mode LIST_H = (3/4)*fp.h LIST_W = EWIDTH -- Add a background from the theme. This looks into the theme and get the -- background property. bg = fp.image{ style = "background" } -- The Lua dofile function imports another file and executes it as Lua. dofile("data/sblist_data"); -- Create the scrollable area in portrait mode and set kinetic scrolling scroller = fp.scrollbar{ x = 130, y = 50, w = LIST_W, h = LIST_H, kinetic = true } -- Create a vertical layout to put the entries into. The layout -- will automatically place the entries one after the other. list = fp.layout{ dir = "vertical" } scroller:add(list) entry = {} for i, v in ipairs(Contacts) do -- Create a container to store the items in a list element. entry[i] = fp.container{} list:child_add(entry[i]) entry[i]:add(fp.checkbox{}) entry[i]:add(fp.text{ text = v[1], style ="strong" }, 50, 10) entry[i]:add(fp.text{ text = v[2], style ="small" }, 50, 30) entry[i]:add(fp.image{ file = v[3], w=40, h=40 }, 130, 10) entry[i]:resize(EWIDTH, EHEIGHT) entry[i]:show() end fp.begin()