This functionality internal to tkoutline is used to protect the bullets from being deleted and to keep the cursor off the protected text. It depends on the wcb package 1
The implementation is independent of tkoutline and can be found at http://tkoutline.sourceforge.net/cvs/lib/outlinewidget/textprotect.tcl
To start protecting a given text widget, make the following call:
- setWidgetProtections win
Then to protect a range of text from being deleted or from having the cursor, just add a text widget tag with the name readonly. Another special tag used by this package is the separator tag. It is used internally for the case when all the text of a writable region disappears because the user deletes it. The separator tag allows the cursor to still be placed and text to be inserted where the writable region used to be. To understand this better, run the example below and delete all the text of a writable region and then move the cursor around. The separator tag must be used externally for the case where a writable region starts off empty. Without the separator tag, the writable region cannot be detected.
The following example will work from within tkoutline's console. Just launch tkoutline, hit F2 and paste in the following text:
toplevel .t ::text .t.t pack .t.t ::outlinewidget::setWidgetProtections .t.t .t.t insert end readonly\n readonly .t.t insert end writable .t.t insert end \nreadonly\t readonly writable {} \treadonly\n readonly .t.t tag configure readonly -background cyan