|1 (2019-01-12)||Initial version|
|1.1 (2019-01-14)||Bug in AddMsg fixed.|
When working with MIT App Inventor 2, debugging, especially debugging events, is quite tedious. The "limited string list" presented here is very well suited for collecting debug messages and displaying the latest of them. If a newly recorded message exceeds the capacity of the list, the first entry is removed. The capacity is adjustable.
The highlight of this list, however, are the two methods ToString and ToReverseString. They return the entire contents of the list as a single multiline string, one row for each list item.
The ZIP archive UrsLimitStringList for downloading. The archive contains the source code and the compiled binary and a sample project to upload to the App Inventor.
|Adds a new line to the end of the list.||If this addition exceeds the capacity of the list, the first item is removed from the list.|
|Gets or sets the separator string for AddMsg.||Default value is ":␣". Required for AddMsg (next block).|
|Adds a new line to the end of the list..||Line
|The content of the list is deleted.|
|Gets the item with the number specified in Index.||The numbering starts with 1. If the Index entry is outside the valid range [ 0..Length ], an empty string is returned.|
|Gets the first or last item in the list.||If the list is empty, an empty string is returned.|
|Gets the number of items in the list.|
|Returns a boolean value indicating whether the list contains items.||Return values are true or false.|
|Gets the entire contents of the list as a single multi-line string. For each list item, a single row is generated. ToString returns the rows in the order they had been added. ToReverseString does this in reverse order.||The individual lines are separated by "\n".|
|Gets or sets the capacity of the list.||Values < 1 are ignored.|
|The initial capacity can also be set in the Designer. Likewise the separator string.|
|These events are triggered when the corresponding method of the list block is called.
Each event then fires ContentChanged.
|The ContentChanged event is fired when the content of the list changes. ContentChanged fires after the individual events.||
This procedure transfers the properties of the list to the screen components. This procedure is called whenever something has changed.
|cmdAdd adds the text from the input field tbxAdd above to the list.|
|cmdClear clears the list.|
|cmdLimit defines a new capacity of the list depending on the input field tbxLimit.|
|cbxReverseOrder defines the order of the list elements in the lower display field lblConent.|
For developing own extensions I gathered some tips: AI2 FAQ: Develop Extensions.