Skip to end of metadata
Go to start of metadata


The itemview can be used to display a menu on the Screvle touch screen. You can assign as much (menu) items as you want, the itemview will display the items on several pages if necessary.


mgf.createItemView( )

Contructor example
itemview = mgf.createItemView()


itemsItemThe items assigned to the itemViewWrite only
titlestringThe font of the label of the buttonRead / Write


ItemView does not support any additional functions.


First we create the itemview, then we create a table of items that will be assigned to the itemview.

The items can have a label, a description and an icon and since it is a subclass of widget it can also have an actionListener for instance.

Example: ItemView
-- Hint: To display this itemView again after displaying widgets, just setWidget to the itemView.
function backToItemView()
  mgf.setWidget( itemview )
function showButton()
    normal = mgf.createButton( "Go Back" )
    normal.actionListener = backToItemView
    mgf.setWidget( normal )
-- Create an ItemView widget
itemview = mgf.createItemView()
itemview.title = "Itemview Demo"
-- Create 7 Item widgets.
items = {}
for i=1,7 do
  table.insert( items, mgf.createItem( "Label " .. ( #items + 1 ), "Description " .. ( #items + 1 ) ) )

-- Assign the items table to the itemview
itemview.items = items
items[ 1 ].label = "Show button"
items[ 1 ].description = "Change the main widget to a button"
items[ 1 ].actionListener = showButton
items[ 2 ].label = "Item 2"
items[ 2 ].description = "Item 2 description"
items[ 3 ].label = "Item 3"
items[ 4 ].label = "Item 4"
items[ 5 ].label = "Item 5"
items[ 6 ].label = "Item 6"
items[ 7 ].label = "Item 7"
mgf.setWidget( itemview )

Adding an Icon

You can easily add an icon to each item. An icon is a widget (e.g. you can use a label or an image)

image = mgf.createImage( "icon.tga" ) -- Make sure you have an icon.tga image on the SD card for this to work!
label = mgf.createLabel ("Icon", mgf.FontSmall )

items[ 1 ].icon = image
items[ 2 ].icon = label



Vertically align label in center

To make sure the label of the item is vertically aligned in the center, use nil as description.

items[ 1 ].description = nil

  • No labels