Child pages
  • ListEditor
Skip to end of metadata
Go to start of metadata

This is a sub-class of Widget. A ListEditor is used display a list of options (strings) and allows the user to select one.

For a more advance way to display a menu, check out the ItemView Widget.

Constructor

mgf.createListEditor()

Fields

FieldTypeDescriptionRead/Write
items

Table

A table containing the text-strings in the list.Write Only
selectedNumberThe selected item of the list.Read / Write

Functions

ListEditor does not support any additional functions.


Examples
 

In this example the ListEditor is used inside a Dialog. Of course using the Dialog is optional.

 

Example: listEditor with Dialog
-- Create listEditor
listEditor = mgf.createListEditor()
 
-- Add items to listEditor
listEditor.items = { "Item1", "Item2", "Item3", "Item4", "Item5" }
 
-- Add the listEditor to a dialog
dialog = mgf.createDialog( listEditor, "Select an item", mgf.ModeOKCancel )
 
-- Create an actionListener for the dialog
dialog.actionListener  = function ( widget, action )
  print( "Action: ", action )
  print( "Selected Item" .. listEditor.selected )
end
 
mgf.setWidget( dialog )

 

 

  • No labels