http://tkoutline.sourceforge.net/cvs/lib/outlinewidget/listitem.tcl
This functionality is an effort to extract the generic listitem based code that is independent of the tree structure. This functionality is being extracted from http://tkoutline.sourceforge.net/cvs/lib/outlinewidget/treedisplay.tcl.
The listitem display functionality consists of items and within each item, there are fields. Items are separated by newlines and fields are tab character separated.
Beyond the standard text widget indices, indices of the form item.field.first and item.field.last are allowed.
The API (TODO: examples and more details):
- listitem::insert win index itemId fieldList ?extraTags itemId fieldList extraTags ...?
Inserts an item with the given itemId and the contents given by fieldList into the text widget at the given index. FieldList is a list of the form:
fieldName {text ?{tag1 tag2...}?}
extraTags is a list of the following form and is used to apply more tags to the fields:
fieldPattern tagList ?fieldPattern tagList..?
Examples: TODO
- listitem::delete win startItem ?endItem?
Deletes the range of items starting with the given startItem and ending with the given endItem. If endItem is omitted, then only the item identified by startItem will be deleted.
- listitem::index win itemIdx
Returns the numeric text widget index corresponding to the given index.
- listitem::prev win itemId
Returns the id of the item preceding the given itemId. The empty string is returned if the given item is the firstt item.
- listitem::next win itemId
Returns the id of the item following the given itemId. The empty string is returned if the given item is the last item.
- listitem::exists win itemId
Returns 1 if the given itemId is present in the widget. Returns 0 otherwise.
- listitem::itemAtIdx win index
Returns the id of the item at the given index
- listitem::itemsWithTag win tag
Returns the ids of the items with the given tag
- listitem::setField win item field value
Changes the value of the given field in the given item to the given value
- listitem::getField win item field
Returns the value of the given field in the given item