(new editor-canvas% [parent parent] [ [editor editor] [style style] [scrolls-per-page scrolls-per-page] [label label] [wheel-step wheel-step] [line-count line-count] [horizontal-inset horizontal-inset] [vertical-inset vertical-inset] [enabled enabled] [vert-margin vert-margin] [horiz-margin horiz-margin] [min-width min-width] [min-height min-height] [stretchable-width stretchable-width] [stretchable-height stretchable-height]]) → (is-a?/c editor-canvas%)
(or/c (is-a?/c frame%) (is-a?/c dialog%) (is-a?/c panel%) (is-a?/c pane%))
editor : (or/c (or/c (is-a?/c text%) (is-a?/c pasteboard%)) #f) = #f
(listof (or/c 'no-border 'control-border 'combo 'no-hscroll 'no-vscroll 'hide-hscroll 'hide-vscroll 'auto-vscroll 'auto-hscroll 'resize-corner 'no-focus 'deleted 'transparent)) = null scrolls-per-page : (integer-in 1 10000) = 100 label : (or/c label-string? #f) = #f wheel-step : (or/c (integer-in 1 10000) #f) = 3 line-count : (or/c (integer-in 1 1000) #f) = #f horizontal-inset : spacing-integer? = 5 vertical-inset : spacing-integer? = 5 enabled : any/c = #t vert-margin : spacing-integer? = 0 horiz-margin : spacing-integer? = 0 min-width : (or/c dimension-integer? #f) = #f min-height : (or/c dimension-integer? #f) = #f stretchable-width : any/c = #t stretchable-height : any/c = #t
The style list can contain the following flags:
omits a border around the canvas
gives the canvas a border that is like a text-field% control
gives the canvas a combo button that is like a combo-field% control; this style is intended for use with 'control-border, 'hide-hscroll, and 'hide-vscroll
disallows horizontal scrolling and hides the horizontal scrollbar
disallows vertical scrolling and hides the vertical scrollbar
allows horizontal scrolling, but hides the horizontal scrollbar
allows vertical scrolling, but hides the vertical scrollbar
automatically hides the horizontal scrollbar when unneeded (unless 'no-hscroll or 'hide-hscroll is specified)
automatically hides the vertical scrollbar when unneeded (unless 'no-vscroll or 'hide-vscroll is specified)
leaves room for a resize control at the canvas’s bottom right when only one scrollbar is visible
prevents the canvas from accepting the keyboard focus when the canvas is clicked or when the focus method is called
creates the canvas as initially hidden and without affecting parent’s geometry; the canvas can be made active later by calling parent’s add-child method
the canvas is “erased” before an update using its parent window’s background; see canvas<%> for information on the interaction of 'transparent and offscreen buffering
While vertical scrolling of text editors is based on lines, horizontal scrolling and pasteboard vertical scrolling is based on a fixed number of steps per horizontal page. The scrolls-per-page argument sets this value.
If line-count is not #f, it is passed on to the set-line-count method.
For information about the enabled argument, see window<%>. For information about the horiz-margin and vert-margin arguments, see subarea<%>. For information about the min-width, min-height, stretchable-width, and stretchable-height arguments, see area<%>.
(send an-editor-canvas allow-scroll-to-last on?) → void? on? : any/c
(send an-editor-canvas allow-tab-exit on?) → void? on? : any/c
When tab-exit is enabled for an editor canvas, Tab and Enter keyboard events are consumed by a frame’s default on-traverse-char method; in addition, a dialog’s default method consumes Escape key events. Otherwise, on-traverse-char allows the keyboard events to be propagated to the canvas.
(send an-editor-canvas force-display-focus on?) → void? on? : any/c
→ (integer-in 1 10000) (send an-editor-canvas horizontal-inset step) → void? step : (integer-in 1 10000)
(send an-editor-canvas lazy-refresh on?) → void? on? : any/c
See also get-editor.
See also get-editor.
This method is called after clearing the margin around the editor, unless the canvas is created with the 'transparent style, but the editor area is not automatically cleared. In other words, editor-canvas% update by default is like canvas% update with the 'no-autoclear style, except that the margin around the editor area is always cleared.
width : dimension-integer? height : dimension-integer?
The localx, localy, w, and h arguments specify a region of the editor to be made visible by the scroll (in editor coordinates).
If refresh? is not #f, then the editor is updated immediately after a successful scroll.
if the range doesn’t fit in the visible area, show the top-left region
no special scrolling instructions
if the range doesn’t fit in the visible area, show the bottom-right region
(send an-editor-canvas scroll-with-bottom-base on?) → void? on? : any/c
(send an-editor-canvas set-editor edit [ redraw?]) → void? edit : (or/c (or/c (is-a?/c text%) (is-a?/c pasteboard%)) #f) redraw? : any/c = #t
If redraw? is #f, then the editor is not immediately drawn; in this case, something must force a redraw later (e.g., a call to the on-paint method).
If the canvas has a line count installed with set-line-count, the canvas’s minimum height is adjusted.
If the line count is set to #f, then the canvas’s graphical minimum height is restored to its original value.
(send an-editor-canvas vertical-inset step) → void? step : (integer-in 1 10000)
→ (or/c (integer-in 1 10000) #f) (send an-editor-canvas wheel-step step) → void? step : (or/c (integer-in 1 10000) #f)