outline widget
Not logged in

I plan to modify the tkoutline code so the core outline functionality is available independent of the rest of the application. Functionality from the tkoutline application that won't be part of this widget includes menus, the notebook tab interface, persistence to and from files. I expect the following benefits from doing this:

This currently under developement, so it is likely to change...

Creates a new outline widget with the given window pathname. If a tree is given then the outline is populated with that tree. If the tree is not given, then a new one will be created. The tree, if given, must support the API of the tree data structure in tcllib 1.

This outline widget is built on top of the text widget. Knowledge of how the text widget 2 operates is useful in order to programmatically make use of the outline widget.


Options


Widget commands

Allows information about the tree to be queried or manipulated. The syntax for command args is the same as that for the tree data structure in tcllib 3. Any operations that modify the tree through this interface will automatically be reflected in the display. As documented by tcllib a node in a tree can have any number of key/value pairs associated. The outline widget sets aside one special key called -expand which controls whether the node is expanded or collapsed in the display.

Note: All read operations are currently supported, but only insert, move, cut, and delete are supported for modification (splice and swap are not supported yet)

Examples

 outline .o  ;# Create the outline.  A new tree with a single node is created.
 set newNode .o tree insert root 0             ;# Create a new node as the first child of root
 .o tree set $newNode title "My very own node"   ;# Set the node's text
 .o tree set $newNode mykey "Some value"         ;# Create a user-defined key/value
 set childNodes .o tree children root          ;# Get a list of nodes that are children of root
 .o tree insert $newNode 0                     ;# Add a child
 .o tree set $newNode expand 0                 ;# Collapse node1
 .o tree delete $newNode                       ;# Delete the node

Returns the outline widget's tree command. Any modify operations performed on this tree will automatically update the display (just as if the tree subcommand were used). The purpose of this subcommand is so functionality can be written that only knows about the tcllib tree API and knows nothing about outlines.

Returns the id of the node at the given text widget index see 4 for the syntax of textindex.

Example

 set node .o getnode insert ;# Get the id of the node at the insertion cursor

Selects the text of the given node.

Returns the starting text widget index for the text of the given node.

Returns the ending text widget index for the text of the given node.

Returns the name of the node whose display location is just after the given node. The empty string is returned if no such node exists.

Returns the name of the node whose display location is just before the given node. The empty string is returned if no such node exists.

Allows the options for the widget to be queried or set

Provides direct access to the text widget commands. In general, any modification of the text in the text widget should be avoided. Instead, modification of the text should be made via the tree structure.

Returns the text widget command so that operations can be performed directly on the text widget without knowing about the outline widget.


Interactive operations

Here lists the functionality that will be built with the above core API and made available for the user to be able to interact with the outline.


The code for this functionality can be viewed online at http://tkoutline.sourceforge.net/cvs/lib/outlinewidget