Source Editing

Basis Editor Function

XOTclIDE editor is based on Tk Text widget. Following functions are available.

Cut Text

Key Accelerator Control-x

Copy Text

Key Accelerator Control-c

Paste Text

Key Accelerator Control-v

Undo

Key Accelerator Control-z available only with Tcl8.4

To see other accelerators see Tk Text Widget documentation. text widget manual.

There are also standard text find and replace dialog available in menu Edit. To search after text in many methods use menu in Browser Component Browser Method->Search Text (F4).

Code Completion

It works similar to file names competition in bash (Unix Shell) or as code competition in typed program-languages IDEs. The user can type the first character of token than press Tab or Control-Space. IDE tries reasonably to complete the token depending of its context. If many alternative competitions are available a pop-down windows list will be displayed.

Figure 2. Code Completion

Following language tokens can be completed

Tcl Core-Commands

commands like: lappend list foreach

Tcl Core-Commands parameters

for example string length|match|range

Defined Tcl Procedures

all procedures known from info procs

Defined XOTcl Classes and Object

all XOTcl Classes and Object in every namespace.

local class methods

all methods (also from derived classes) found per $instance info instprocs

visible variables

variables defined per set append instvar foreach ... or method parameters. Just type $ and press Tabulator key

Navigation in Sources

The menu Method in Component Browse offer some additional help functions for browsing XOTcl/Tcl methods. You can return to last showed method by Functions "Back Method ( Alt-Left )" or "Forward Method ( Alt-Right )" as you know it from you HTML browser.

You can spawn the editor window to extra window by using spawn function

Syntax highlighting

XOTclIDE implements two kinds of syntax highlighting

Simple syntax highlighting

is based on pattern (regexp). It recognize only "" substitution and # comments

Parser-based syntax highlighting

This syntax highlighting give true result. It recognize Tcl core-commands, variables, comments, "" substitution and XOTcl key-words

Figure 3. Syntax Highlighting

Checking parenthesis

Finding opening or closing parenthesis is often hard work for understanding some Tcl method. Make double-click on [{" or ]}" and XOTclIDE will find the corresponding opening or closing parenthesis for you and select it.

Figure 4. Checking Parenthesis

Automatic Indenting

XOTclIDE try to set the same indent in new inserted line as in the last line. If the last character before new line was opening parenthesis { than by new line the indenting will be increased by 4 and closing parenthesis will be inserted

   foreach a $list {here cursor
After new line you will see this code
    foreach a $list {
        here cursor
    }
It is not possible to compute right indenting ex post as known from emacs.

Evaluate Tcl Scripts in Editor

This is very powerful function. It let you evaluate Tcl as in the Tclshell console but is more flexible. You must not type commands but select the string and evaluate it per pop-down menu or keys-accelerators. Now you will notice that in Tcl is everything string. It is also the easiest and fastest way to program in XOTcl/Tcl.

Figure 5. Evaluate Scripts

Menu "Print it" corresponds to Tcl eval command. You can also use Control-q

Figure 6. Substitute Scripts

Menu "Substitute it" corresponds to subst Tcl command.

Figure 7. Inspect Script Evaluation

Menu "Inspect it" evaluate the selected region and try to inspect the returned value if it is a XOTcl object. You can also use Control-g. If the result of last operation is XOTcl object than this object will be displayed in Object inspector.

You can use so called workspaces (see menu System->Workspace ) to evaluate short Tcl scripts.