Manual Pages for UNIX Darwin command on man ctext
MyWebUniversity

Manual Pages for UNIX Darwin command on man ctext

ctext(n) Ctext a text widget with highlighting support ctext(n)

NAME

ctext - Ctext a text widget with highlighting support

SYNOPSIS

package require TTkk package require cctteexxtt ??33..11?? cctteexxtt pathName ?options? ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassss pathName class color keywordlist ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssWWiitthhOOnnllyyCChhaarrSSttaarrtt pathName class color char ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssFFoorrSSppeecciiaallCChhaarrss pathName class color charstring ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssFFoorrRReeggeexxpp pathName class color pattern ::::cctteexxtt::::cclleeaarrHHiigghhlliigghhttCCllaasssseess pathName ::::cctteexxtt::::ggeettHHiigghhlliigghhttCCllaasssseess pathName ::::cctteexxtt::::ddeelleetteeHHiigghhlliigghhttCCllaassss pathName class ::::cctteexxtt::::eennaabblleeCCoommmmeennttss enable ::::cctteexxtt::::ddiissaabblleeCCoommmmeennttss enable pathName hhiigghhlliigghhtt startIndex endIndex pathName ffaassttddeelleettee index1 ?index2? pathName ffaassttiinnsseerrtt pathName ccooppyy pathName ccuutt pathName ppaassttee pathName aappppeenndd

DESCRIPTION

The cctteexxtt package provides the ctext widget which is an enhanced text

widget with support for configurable syntax highlighting and some extra commands.

Ctext overloads the text widget and provides new commands, named hhiigghh-

lliigghhtt, ccooppyy, ppaassttee,ccuutt, aappppeenndd, and eeddiitt. It also provides several commands that allow you to define classes. Each class corresponds to a tag in the widget. CCOOMMMMAANNDDSS cctteexxtt pathName ?options?

Creates and configures a ctext widget.

HHIIGGHHLLIIGGHHTTIINNGG

Highlighting is controlled with text widget tags, that are called high-

light classes. The class is a tag name and can be configured like any text widget tag. Four types of highlight classes are supported. All highlight classes are automatically used by the hhiigghhlliigghhtt method of the widget. ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassss pathName class color keywordlist

Add a highlighting class class to the ctext widget pathName.

The highligthing will be done with the color color. All words in the keywordlist will be highlighted.

# highlight some tcl keywords

::ctext::addHighlightClass .t tclkeywords red [list set info interp uplevel upvar]]

::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssWWiitthhOOnnllyyCChhaarrSSttaarrtt pathName class color char

Add a highlighting class class to the ctext widget pathName.

The highligthing will be done with the color color. All words starting with char will be highlighted.

::ctext::addHighlightClassWithOnlyCharStart .t vars blue \$

::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssFFoorrSSppeecciiaallCChhaarrss pathName class color charstring

Add a highlighting class class to the ctext widget pathName.

The highligthing will be done with the color color. All chars in charstring will be highlighted. ::::cctteexxtt::::aaddddHHiigghhlliigghhttCCllaassssFFoorrRReeggeexxpp pathName class color pattern

Add a highlighting class class to the ctext widget pathName.

The highligthing will be done with the color color. All text parts matching the regexp pattern will be highligthed. ::::cctteexxtt::::cclleeaarrHHiigghhlliigghhttCCllaasssseess pathName Remove all highlight classes from the widget pathName. ::::cctteexxtt::::ggeettHHiigghhlliigghhttCCllaasssseess pathName List all highlight classes for the widget pathName. ::::cctteexxtt::::ddeelleetteeHHiigghhlliigghhttCCllaassss pathName class Delete the highlight class class from the widget pathName ::::cctteexxtt::::eennaabblleeCCoommmmeennttss enable

Enable C comment highlighting. The class for c-style comments is

ccCCoommmmeenntt. The C comment highlighting is disabled by default. ::::cctteexxtt::::ddiissaabblleeCCoommmmeennttss enable Disable C comment highlighting. WWIIDDGGEETT CCOOMMMMAANNDDSS

Each ctext widget created with the above command supports the following

commands and options in addition to the standard text widget commands and options. pathName hhiigghhlliigghhtt startIndex endIndex Highlight the text between startIndex and endIndex. pathName ffaassttddeelleettee index1 ?index2? Delete text range without updating the highlighting. Arguments are identical to the pathName ddeelleettee command inherited from the standard text widget. pathName ffaassttiinnsseerrtt Insert text without updating the highlighting. Arguments are identical to the pathName iinnsseerrtt command inherited from the standard text widget. pathName ccooppyy

Call ttkktteexxttCCooppyy for the ctext instance.

pathName ccuutt

Call ttkktteexxttCCuutt for the ctext instance.

pathName ppaassttee

Call ttkktteexxttPPaassttee for the ctext instance.

pathName aappppeenndd Append the current selection to the clipboard. WWIIDDGGEETT OOPPTTIIOONNSS

Command-Line Switch: -lliinneemmaapp

Database Name: Database Class: Creates a line number list on the left of the widget

Command-Line Switch: -lliinneemmaappffgg

Database Name: Database Class: Changes the foreground of the linemap. The default is the same color as the main text widget.

Command-Line Switch: -lliinneemmaappbbgg

Database Name: Database Class: Changes the background of the linemap. The default is the same color as the main text widget.

Command-Line Switch: -lliinneemmaappsseelleeccttffgg

Database Name: Database Class: Changes the selected line foreground. The default is black.

Command-Line Switch: -lliinneemmaappsseelleeccttbbgg

Database Name: Database Class: Changes the selected line background. The default is yellow.

Command-Line Switch: -lliinneemmaappmmaarrkkccoommmmaanndd

Database Name: Database Class:

Calls a procedure or command with the pathName of the ctext win-

dow, the type which is either mmaarrkkeedd or uunnmmaarrkkeedd, and finally the line number selected. The proc prototype is: proc linemarkcmd {win type line}.

See also ctexttestinteractive.tcl

Command-Line Switch: -hhiigghhlliigghhtt

Database Name: Database Class: Takes a boolean value which defines whether or not to highlight text which is inserted or deleted. The default is 1.

Command-Line Switch: -lliinneemmaappmmaarrkkaabbllee

Database Name: Database Class: Takes a boolean value which specifies whether or not lines in the linemap are markable with the mouse. The default is 1. EEXXAAMMPPLLEE package require Tk

package require ctext

proc main {} {

pack [frame .f] -fill both -expand 1

pack [scrollbar .f.s -command {.f.t yview}] -side right -fill y

pack [ctext .f.t -bg black -fg white -insertbackground yellow -yscrollcommand {.f.s set}] -fill both -expand 1

ctext::addHighlightClass .f.t widgets purple [list ctext button label text frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tkchooseDir tkgetSaveFile tkgetOpenFile tkchooseColor tkoptionMenu]

ctext::addHighlightClass .f.t flags orange [list -text -command -yscrollcommand -xscrollcommand -background -foreground -fg -bg -highlightbackground -y -x -highlightcolor -relief -width -height -wrap -font -fill -side -outline -style -insertwidth -textvariable -activebackground -activeforeground -insertbackground -anchor -orient -troughcolor -nonewline -expand -type -message -title -offset -in -after -yscroll -xscroll -forward -regexp -count -exact -padx -ipadx -filetypes -all -from -to -label -value -variable -regexp -backwards -forwards -bd -pady -ipady -state -row -column -cursor -highlightcolors -linemap -menu -tearoff -displayof -cursor -underline -tags -tag]

ctext::addHighlightClass .f.t stackControl red {proc uplevel namespace while for foreach if else}

ctext::addHighlightClassWithOnlyCharStart .f.t vars mediumspringgreen "\$"

ctext::addHighlightClass .f.t variablefuncs gold {set global variable unset}

ctext::addHighlightClassForSpecialChars .f.t brackets green {[]{}}

ctext::addHighlightClassForRegexp .f.t paths lightblue {\.[a-zA-Z0-9\\-]+}

ctext::addHighlightClassForRegexp .f.t comments khaki {#[^\n\r]*}

.f.t fastinsert end [info body main]

pack [frame .f1] -fill x

.f.t highlight 1.0 end

pack [button .f1.exit -text Exit -command exit] -side left

pack [entry .e] -side bottom -fill x

.e insert end "ctext::deleteHighlightClass .f.t "

bind .e {eval [.e get]} } main

Further examples are in the source package for ctext.

TTHHAANNKKSS Kevin Kenny, Neil Madden, Jeffrey Hobbs, Richard Suchenwirth, Johan Bengtsson, Mac Cody, G~A1/4nther, Andreas Sievers, and Michael Schlenker.

SEE ALSO

resyntax, text KKEEYYWWOORRDDSS syntax highlighting, text, widget COPYRIGHT Copyright (c) George Peter Staplin

ctext 3.1 ctext(n)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™