On this page:
after-change-style
after-delete
after-insert
after-merge-snips
after-set-position
after-set-size-constraint
after-split-snip
call-clickback
can-change-style?
can-delete?
can-insert?
can-set-size-constraint?
caret-hidden?
change-style
copy
copy-self-to
cut
delete
do-copy
do-paste
do-paste-x-selection
erase
find-line
find-next-non-string-snip
find-position
find-position-in-line
find-snip
find-string
find-string-all
find-wordbreak
flash-off
flash-on
get-anchor
get-between-threshold
get-character
get-end-position
get-file-format
get-line-spacing
get-overwrite-mode
get-position
get-region-data
get-revision-number
get-snip-position
get-snip-position-and-location
get-start-position
get-styles-sticky
get-tabs
get-text
get-top-line-base
get-visible-line-range
get-visible-position-range
get-wordbreak-map
hide-caret
insert
kill
last-line
last-paragraph
last-position
line-end-position
line-length
line-location
line-paragraph
line-start-position
move-position
on-change-style
on-default-char
on-default-event
on-delete
on-insert
on-new-string-snip
on-new-tab-snip
on-reflow
on-set-size-constraint
paragraph-end-line
paragraph-end-position
paragraph-start-line
paragraph-start-position
paste
paste-next
paste-x-selection
position-line
position-location
position-locations
position-paragraph
read-from-file
remove-clickback
scroll-to-position
set-anchor
set-autowrap-bitmap
set-between-threshold
set-clickback
set-file-format
set-line-spacing
set-overwrite-mode
set-paragraph-alignment
set-paragraph-margins
set-position
set-position-bias-scroll
set-region-data
set-styles-sticky
set-tabs
set-wordbreak-func
set-wordbreak-map
split-snip
write-to-file
Inherited methods:
from editor<%>
add-canvas
add-undo
adjust-cursor
after-edit-sequence
after-load-file
after-save-file
auto-wrap
begin-edit-sequence
begin-write-header-footer-to-file
blink-caret
can-do-edit-operation?
can-load-file?
can-save-file?
clear
clear-undos
copy-self
dc-location-to-editor-location
default-style-name
do-edit-operation
editor-location-to-dc-location
end-edit-sequence
end-write-header-footer-to-file
find-first-snip
find-scroll-line
get-active-canvas
get-admin
get-canvas
get-canvases
get-dc
get-descent
get-extent
get-file
get-filename
get-flattened-text
get-focus-snip
get-inactive-caret-threshold
get-keymap
get-load-overwrites-styles
get-max-height
get-max-undo-history
get-max-view-size
get-max-width
get-min-height
get-min-width
get-paste-text-only
get-snip-data
get-snip-location
get-space
get-style-list
get-view-size
global-to-local
in-edit-sequence?
insert-box
insert-file
insert-image
insert-port
invalidate-bitmap-cache
is-locked?
is-modified?
load-file
local-to-global
locations-computed?
lock
locked-for-flow?
locked-for-read?
locked-for-write?
needs-update
num-scroll-lines
on-change
on-char
on-display-size
on-display-size-when-ready
on-edit-sequence
on-event
on-focus
on-load-file
on-local-char
on-local-event
on-new-box
on-new-image-snip
on-paint
on-save-file
on-snip-modified
own-caret
print
print-to-dc
put-file
read-footer-from-file
read-header-from-file
redo
refresh
refresh-delayed?
release-snip
remove-canvas
resized
save-file
save-port
scroll-editor-to
scroll-line-location
scroll-to
select-all
set-active-canvas
set-admin
set-caret-owner
set-cursor
set-filename
set-inactive-caret-threshold
set-keymap
set-load-overwrites-styles
set-max-height
set-max-undo-history
set-max-width
set-min-height
set-min-width
set-modified
set-paste-text-only
set-snip-data
set-style-list
style-has-changed
undo
use-file-text-mode
write-footers-to-file
write-headers-to-file
Version: 4.1.3.3

text% : class?

  superclass: object%

  extends: editor<%>

A text% object is a standard text editor. A text editor is displayed on the screen through an editor-canvas% object or some other display.

(new text% [[line-spacing line-spacing]]    
  [tab-stops tab-stops]    
  [[auto-wrap auto-wrap]])  (is-a?/c text%)
  line-spacing : (and/c real? (not/c negative?)) = 1.0
  tab-stops : (listof real?)
  auto-wrap : any/c = #f

The line-spacing argument sets the additional amount of space (in DC units) inserted between each line in the editor when the editor is displayed. This spacing is included in the reported height of each line.

See set-tabs for information about tabstops.

If auto-wrap is true, then auto-wrapping is enabled via auto-wrap.

A new keymap% object is created for the new editor. See also get-keymap and set-keymap.

A new style-list% object is created for the new editor. See also get-style-list and set-style-list.

(send a-text after-change-style start len)  void?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called after the style is changed for a given range (and after the display is refreshed; use on-change-style and begin-edit-sequence to avoid extra refreshes when after-change-style modifies the editor).

See also can-change-style? and on-edit-sequence.

No internals locks are set when this method is called.

Default implementation: Does nothing.

(send a-text after-delete start len)  void?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called after a given range is deleted from the editor (and after the display is refreshed; use on-delete and begin-edit-sequence to avoid extra refreshes when after-delete modifies the editor).

The start argument specifies the starting position of the deleted range. The len argument specifies number of deleted items (so start+len is the ending position of the deleted range).

See also can-delete? and on-edit-sequence.

No internals locks are set when this method is called.

Default implementation: Does nothing.

(send a-text after-insert start len)  void?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called after items are inserted into the editor (and after the display is refreshed; use on-insert and begin-edit-sequence to avoid extra refreshes when after-insert modifies the editor).

The start argument specifies the position of the insert. The len argument specifies the total length (in positions) of the inserted items.

See also can-insert? and on-edit-sequence.

No internals locks are set when this method is called.

Default implementation: Does nothing.

(send a-text after-merge-snips pos)  void?
  pos : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called after adjacent snips in the editor are combined into one.

The pos argument specifies the position within the editor where the snips were merged (i.e., one old snip was just before pos, one old was just after pos, and the new snip spans pos).

See also merge-with.

Default implementation: Does nothing.

(send a-text after-set-position)  void?

Refine this method with augment.

Specification: Called after the start and end position have been moved (but not when the position is moved due to inserts or deletes).

See also on-edit-sequence.

Default implementation: Does nothing.

(send a-text after-set-size-constraint)  void?

Refine this method with augment.

Specification: Called after the editor’s maximum or minimum height or width is changed (and after the display is refreshed; use on-set-size-constraint and begin-edit-sequence to avoid extra refreshes when after-set-size-constraint modifies the editor).

(This callback method is provided because setting an editor’s maximum width may cause lines to be re-flowed with soft carriage returns.)

See also can-set-size-constraint? and on-edit-sequence.

Default implementation: Does nothing.

(send a-text after-split-snip pos)  void?
  pos : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called after a snip in the editor is split into two, either through a call to split-snip or during some other action, such as inserting.

The pos argument specifies the position within the editor where a snip was split.

Default implementation: Does nothing.

(send a-text call-clickback start end)  void?
  start : exact-nonnegative-integer?
  end : exact-nonnegative-integer?

Simulates a user click that invokes a clickback, if the given range of positions is within a clickback’s region. See also Clickbacks.

(send a-text can-change-style? start len)  boolean?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called before the style is changed in a given range of the editor. If the return value is #f, then the style change will be aborted.

The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-change-style to modify the editor, if necessary.

See also on-change-style, after-change-style, and on-edit-sequence.

Default implementation: Returns #t.

(send a-text can-delete? start len)  boolean?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called before a range is deleted from the editor. If the return value is #f, then the delete will be aborted.

The start argument specifies the starting position of the range to delete. The len argument specifies number of items to delete (so start+len is the ending position of the range to delete).

The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-delete to modify the editor, if necessary.

See also on-delete, after-delete, and on-edit-sequence.

Default implementation: Returns #t.

(send a-text can-insert? start len)  boolean?
  start : exact-nonnegative-integer?
  len : exact-nonnegative-integer?

Refine this method with augment.

Specification: Called before items are inserted into the editor. If the return value is #f, then the insert will be aborted.

The start argument specifies the position of the potential insert. The len argument specifies the total length (in positions) of the items to be inserted.

The editor is internally locked for writing during a call to this method (see also Internal Editor Locks). Use after-insert to modify the editor, if necessary.

See also on-insert, after-insert, and on-edit-sequence.

Default implementation: Returns #t.

(send a-text can-set-size-constraint?)  boolean?

Refine this method with augment.

Specification: Called before the editor’s maximum or minimum height or width is changed. If the return value is #f, then the change will be aborted.

(This callback method is provided because setting an editor’s maximum width may cause lines to be re-flowed with soft carriage returns.)

See also on-set-size-constraint, after-set-size-constraint, and on-edit-sequence.

Default implementation: Returns #t.

(send a-text caret-hidden?)  boolean?

Returns #t if the caret is hidden for this editor or #f otherwise.

See also hide-caret.

(send a-text change-style delta    
  [start    
  end    
  counts-as-mod?])  void?
  delta : (or/c (is-a?/c style-delta%) false/c)
  start : (or/c exact-nonnegative-integer? (one/of 'start))
   = 'start
  end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end
  counts-as-mod? : any/c = #t
(send a-text change-style style    
  [start    
  end    
  counts-as-mod?])  void?
  style : (or/c (is-a?/c style<%>) false/c)
  start : (or/c exact-nonnegative-integer? (one/of 'start))
   = 'start
  end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end
  counts-as-mod? : any/c = #t

Extends change-style in editor<%>.

Changes the style for a region in the editor by applying a style delta or installing a specific style. If start is 'start and end is 'end, then the currently selected items are changed. Otherwise, if end is 'end, then the style is changed from start until the end of the selection. If counts-as-mod? is #f, then set-modified is not called after applying the style change.

When style is provided: The editor’s style list must contain style, otherwise the style is not changed. See also convert in style-list%.

(send a-text copy extend? time [start end])  void?
  extend? : any/c
  time : (and/c exact? integer?)
  start : (or/c exact-nonnegative-integer? (one/of 'start))
   = 'start
  end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end

Extends copy in editor<%>.

Copies specified range of text into the clipboard. If extend? is not #f, the old clipboard contents are appended. If start is 'start or end is 'end, then the current selection start/end is used.

See Cut and Paste Time Stamps for a discussion of the time argument. If time is outside the platform-specific range of times, an exn:fail:contract exception is raised.

(send a-text copy-self-to dest)  void?
  dest : (or/c (is-a?/c text%) (is-a?/c pasteboard%))

Overrides copy-self-to in editor<%>.

In addition to the default copy-self-to in editor<%> work, this editor’s file format, wordbreak function, wordbreak map, click-between-threshold, caret visibility state, overwrite mode state, and autowrap bitmap are installed into dest.

(send a-text cut extend? time [start end])  void?
  extend? : any/c
  time : (and/c exact? integer?)
  start : (or/c exact-nonnegative-integer? (one/of 'start))
   = 'start
  end : (or/c exact-nonnegative-integer? (one/of 'end)) = 'end

Overrides cut in editor<%>.

Copies and then deletes the specified range. If extend? is not #f, the old clipboard contents are appended. If start is 'start or end is 'end, then the current selection start/end is used.

See Cut and Paste Time Stamps for a discussion of the time argument. If time is outside the platform-specific range of times, an exn:fail:contract exception is raised.

(send a-text delete start [end scroll-ok?])  void?
  start : (or/c exact-nonnegative-integer? (one/of 'start))
  end : (or/c exact-nonnegative-integer? (one/of 'back)) = 'back