ListView
public class ListView : View
ListView is a control used to displays rows of data.
# Initialization: The ListView offers both easy to use, as well as customizable options for the data being rendered. For very simple scenarios there is a constructor that takes an array of strings, and provides a way of rendering those, and selecting those (the selection can be retrieved through the API).
If you desire to customize the rendering of the data, or if your data is not a string, a separate constructor takes both a ListViewDataSource instance, which is used to describe your information to display, as well as a rendering method that is invoked to render every line on demand and is expected to return a string, which is in turn rendered.
A more advanced method requires both the datasource and the delegate to be specified, in this scenario, you can control directly how the contents of your data source are rendered.
To scroll to a particular place, you can set the “topItem” property
-
If set, this allows the elements on the list to be marked If true, this will render the items with the mark strings
Declaration
Swift
public var allowMarking: Bool { get set }
-
Undocumented
Declaration
Swift
public var allowsMultipleSelection: Bool { get set }
-
Undocumented
Declaration
Swift
public var dataSource: ListViewDataSource { get set }
-
Specifies the delegate instance that will receive important notifications from the ListView
Declaration
Swift
public var delegate: ListViewDelegate { get set }
-
Convenience callback method that is invoked with the index of the item that was activated, must return true if it consumed the event, false otherwise. If set, this is called after the
ListViewDelegate.activate
method.Declaration
Swift
public var activate: ((_ index: Int) -> Bool)?
-
Constructs a ListView with a datasource and a method that can produce a rendered line on demand
Declaration
Swift
public init(dataSource: ListViewDataSource, renderWith: @escaping ((_ row: Int, _ width: Int) -> String))
Parameters
dataSource
the datasource describing the data
renderWith
method that can be used to render the data on demand by returning a string.
-
Initialization method to allow the delegate and datasource to be set later, withour referencing self
Declaration
Swift
public override init()
-
Initialies a ListView with botht he source and delegate fully specified.
Declaration
Swift
public init (dataSource: ListViewDataSource, delegate: ListViewDelegate)
Parameters
dataSource
Should provide information about the data being rendered
delegate
Should provide the methods to render and respond to the ListView
-
Initialies a ListView that presents an array of strings with the default formatting
Declaration
Swift
public init(items: [String])
Parameters
items
Array of strings to render
-
The index of the item to display at the top of the list
Declaration
Swift
public var topItem: Int { get set }
-
Controls the current visibly selected item
Declaration
Swift
public var selectedItem: Int { get set }
-
If this property is set to true, when the user reaches the end of the scrollview boundaries the event will not be processed, allowing automatically focusing the next view in the direction of the moevemnt
Declaration
Swift
public var autoNavigateToNextViewOnBoundary: Bool
-
Undocumented
Declaration
Swift
public func redrawColor(_ painter: Painter, selection: Bool)
-
Declaration
Swift
public override func processKey(event: KeyEvent) -> Bool
-
Moves the selection to the previous item
Declaration
Swift
public func moveSelectionUp() -> Bool
Return Value
True if the selection was moved, false otherwise
-
Moves the selection to the next item
Declaration
Swift
public func moveSelectionDown() -> Bool
Return Value
True if the selection was moved, false otherwise
-
Moves the selection one page up
Declaration
Swift
public func movePageUp() -> Bool
Return Value
true if this change the selected position, false otherwise
-
Moves the selection one page up
Declaration
Swift
public func movePageDown() -> Bool
Return Value
true if this change the selected position, false otherwise
-
Moves the selection cursor to the first element
Declaration
Swift
public func moveHome()
-
Moves the selection cursor to the last element
Declaration
Swift
public func moveEnd()
-
Undocumented
Declaration
Swift
public func reload()
-
Declaration
Swift
public override func positionCursor()
-
Declaration
Swift
public override func mouseEvent(event: MouseEvent) -> Bool