The Edit class, derived from File, is a top-level window that contains an emacs-like editor with emacs-like key bindings. It has full capabilities for editing text, saving files, etc. The help window gives additional information.
You may create an instance of the Edit class as follows:
::tycho::Edit .e
.e centerOnScreen
.e insertFile
The top-level Edit class window
is implemented by packing into it a megawidget that implements
the editor itself.
This megawidget, the EditText class, can be used
stand-alone inside any other widget or window.
For example, the
EntryQuery class
uses EditText for multi-line entries.
Classes derived from Edit should similarly be divided into a top-level
window class and a megawidget. This gives maximum flexibility for
using the classes in unanticipated ways.
The convention is that text editing widgets have the suffix "Text"
appended to the name of the corresponding top-level window class.
Thus, EditText is the widget used in the Edit class.
Similarly, HTMLText is a widget used in the HTML class.
We can create an instance of the EditText megawidget in its own top-level
window as follows:
EditText Class
::tycho::TopLevel .t
::tycho::EditText .t.t
pack .t.t
.t centerOnScreen
delete object .t
::tycho::TopLevel .p
::tycho::EditText .p.t \
-text "Initial text in the text widget" \
-readonly "yes" \
-width 60 \
-scrollbar 0 \
-height 20
pack .p.t
.p centerOnScreen
.p.t configure -readonly no
.p.t readFile $ptolemy/tycho/kernel/Color.tcl
delete object .p
Copyright © 1996, The Regents of the University of California.
All rights reserved.
Last updated: 96/04/09,
comments to: