3.7 canvas%
Implements: canvas<%>
A canvas% object is a general-purpose window for drawing
and handling events.
(->newcanvas% (parent_) [(style_)] [(paint-callback_)] [(label_)] [(gl-config_)] [(enabled_)] [(vert-margin_)] [(horiz-margin_)] [(min-width_)] [(min-height_)] [(stretchable-width_)] [(stretchable-height_)])canvas%object
parent:frame%,dialog%,panel%, orpane%object
style=null: list of symbols in'(border control-border combo vscroll hscroll resize-corner gl deleted no-autoclear transparent)
paint-callback=void: procedure of two arguments: acanvas%object and adc<%>object
label=#f: string (up to 200 characters) or#f
gl-config=#f:gl-config%object or#f
enabled=#t: boolean
vert-margin=0: exact integer in [0, 1000]
horiz-margin=0: exact integer in [0, 1000]
min-width=0: exact integer in [0, 10000]
min-height=0: exact integer in [0, 10000]
stretchable-width=#t: boolean
stretchable-height=#t: booleanThe
styleargument indicates one or more of the following styles:'border-- gives the canvas a thin border'control-border-- gives the canvas a border that is like atext-field%control'combo-- gives the canvas a combo button that is like acombo-field%control; this style is intended for use with'control-borderand not with'hscrollor'vscroll'hscroll-- enables horizontal scrolling (initially visible but inactive)'vscroll-- enables vertical scrolling (initially visible but inactive)'resize-corner-- leaves room for a resize control at the canvas's bottom right when only one scrollbar is visible'gl-- obsolete (every canvas is an OpenGL context where supported)'deleted-- creates the canvas as initially hidden and without affectingparent's geometry; the canvas can be made active later by callingparent'sadd-childmethod'no-autoclear-- prevents automatic erasing of the canvas before calls toon-paint'transparent-- the canvas is automatically ``erased'' before an update using it's parent window's background; the result is undefined if this flag is combined with'no-autoclear
The
'hscrolland'vscrollstyles create a canvas with an initially inactive scrollbar. The scrollbars are activated with eitherinit-manual-scrollbarsorinit-auto-scrollbars, and they can be hidden and re-shown withshow-scrollbars.The
paint-callbackargument is called by the defaulton-paintmethod, using the canvas and the DC returned byget-dcas the argument.The
labelargument names the canvas forget-label, but it is not displayed with the canvas.The
gl-configargument determines properties of an OpenGL context for this canvas, as obtained through the canvas's drawing context. See alsoget-dcandget-gl-contextindc<%>.For information about the
enabledargument, seewindow<%>. For information about thehoriz-marginandvert-marginarguments, seesubarea<%>. For information about themin-width,min-height,stretchable-width, andstretchable-heightarguments, seearea<%>.
Methods
accept-tab-focus
get-canvas-background
get-dc
get-scroll-page
get-scroll-pos
get-scroll-range
get-view-start
get-virtual-size
init-auto-scrollbars
init-manual-scrollbars
min-client-height
min-client-width
on-char
on-event
on-paint
on-scroll
on-tab-in
scroll
set-canvas-background
set-resize-corner
set-scroll-page
set-scroll-pos
set-scroll-range
show-scrollbars
swap-gl-buffers
warp-pointer
with-gl-context
All Methods
accept-drop-files from window<%>
accept-tab-focus from canvas%
client->screen from window<%>
enable from window<%>
focus from window<%>
get-canvas-background from canvas<%>
get-client-size from window<%>
get-cursor from window<%>
get-dc from canvas<%>
get-graphical-min-size from area<%>
get-handle from window<%>
get-height from window<%>
get-label from window<%>
get-parent from area<%>
get-plain-label from window<%>
get-scroll-page from canvas%
get-scroll-pos from canvas%
get-scroll-range from canvas%
get-size from window<%>
get-top-level-window from area<%>
get-view-start from canvas%
get-virtual-size from canvas%
get-width from window<%>
get-x from window<%>
get-y from window<%>
has-focus? from window<%>
horiz-margin from subarea<%>
init-auto-scrollbars from canvas%
init-manual-scrollbars from canvas%
is-enabled? from window<%>
is-shown? from window<%>
min-client-height from canvas<%>
min-client-width from canvas<%>
min-height from area<%>
min-width from area<%>
on-char from canvas<%>
on-drop-file from window<%>
on-event from canvas<%>
on-focus from window<%>
on-move from window<%>
on-paint from canvas<%>
on-scroll from canvas<%>
on-size from window<%>
on-subwindow-char from window<%>
on-subwindow-event from window<%>
on-superwindow-enable from window<%>
on-superwindow-show from window<%>
on-tab-in from canvas<%>
popup-menu from window<%>
refresh from window<%>
screen->client from window<%>
scroll from canvas%
set-canvas-background from canvas<%>
set-cursor from window<%>
set-label from window<%>
set-resize-corner from canvas<%>
set-scroll-page from canvas%
set-scroll-pos from canvas%
set-scroll-range from canvas%
show from window<%>
show-scrollbars from canvas%
stretchable-height from area<%>
stretchable-width from area<%>
swap-gl-buffers from canvas%
vert-margin from subarea<%>
warp-pointer from canvas<%>
with-gl-context from canvas%