Construct the widget.
Construct the widget.
Add an item to the canvas.
Add a tag configuration to the canvas. These can apply options to a tag which can then be applied to any item.
Get an item id nearest to coordinates. If more than one item is at the same closest distance (e.g. two items overlap the point), then the top-most of these items (the last one in the display list) is used. If radius is specified, then it must be a non-negative value. Any item closer than halo to the point is considered to overlap it.
Get items within a selection region.
Get the horizontal position on the canvas that relates to a particular horizontal position on screen.
Get the vertical position on the canvas that relates to a particular vertical position on screen.
This command is used to implement scanning on canvases. This command computes the difference between its xPos and yPos arguments (which are typically mouse coordinates) and the xPos and yPos arguments to the last setScanMark command for the widget. It then adjusts the view by gain times the difference in coordinates, where gain defaults to 1. This command is typically associated with mouse motion events in the widget, to produce the effect of dragging the canvas at high speed through its window.
Set the background color. Use colors from the preset color list or a web style hex color.
This command is used to implement scanning on canvases. Records x and y positions and the canvas's current view. This is used in conjunction with later scanDragTo commands.
Set the scroll increment i.e. how many pixels are scrolled per each click on a scrollbar.
Set the scroll region of the canvas. This region can be scrolled using scrollbars if it's bigger than the canvas widget itself.
Specifies a floating-point value indicating how close the mouse cursor must be to an item before it is considered to be 'inside' the item and able to select it. Defaults to 1.0.
Tag items within a selection region.
Tag an item nearest to coordinates. If more than one item is at the same closest distance (e.g. two items overlap the point), then the top-most of these items (the last one in the display list) is used. If radius is specified, then it must be a non-negative value. Any item closer than halo to the point is considered to overlap it.
Tag items that are already tagged with another tag.
Mixin common commands.
Set the border width of the widget.
Set the height of the widget if the geometry manager allows.
Set the relief type of the widget.
Set the width of the widget if the geometry manager allows.
Get floating point values which represent the viewable portion of the text. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right.
Adjusts the view in the window so that the position appears at the left edge of the window. Position must be a fraction between 0.0 (start of the text) and 1.0 (end of the text).
Adjusts the view in the window so that the character index passed is displayed at the left edge of the window.
Scroll the text by a specified amount of characters. Positive values scroll text to the left, negative values scroll text to the right.
Scroll the text by a specified amount of pages. Positive values scroll text to the left, negative values scroll text to the right.
Get floating point values which represent the viewable portion of the text. Each element is a real fraction between 0 and 1; together they describe the vertical span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the bottom, the middle 40% is visible in the window, and 40% of the text is off-screen to the bottom.
Adjusts the view in the window so that the position appears at the top edge of the window. Position must be a fraction between 0.0 (start of the text) and 1.0 (end of the text).
Adjusts the view in the window so that the character index passed is displayed at the top edge of the window.
Scroll the text by a specified amount of characters. Positive values scroll text to the down, negative values scroll text up.
Scroll the text by a specified amount of pages. Positive values scroll text up, negative values scroll text down.
Set the widget's state.
Get the widget's state.
Test if a widget is in a particular state.
Remove the widget's state.
Reset the widget's state to default.
Set the widget's style.
Get the widget's style.
Set if the widget can recieve focus during keyboard traversal.
Get if the widget can recieve focus during keyboard traversal.
Geometry method for loosely placing this widget inside its parent using a web browser model. Widgets flow around each other in the available space.
Geometry method for placing this widget inside its parent using an imaginary grid. Somewhat more direct and intuitive than pack. Choose grid for tabular layouts, and when there's no good reason to choose something else.
Geometry method for placing this widget inside its parent using absolute positioning.
Geometry method for placing this widget inside its parent using relative positioning. In this case the position and size is specified as a floating-point number between 0.0 and 1.0 relative to the height of the parent. 0.5 means the widget will be half as high as the parent and 1.0 means the widget will have the same height as the parent, and so on.
auto canvas = new Canvas(Color.white) .setWidth(350) .setHeight(250) .addItem(new CanvasRectangle([10, 10, 200, 100])) .bind("<ButtonPress-1>", delegate(CommandArgs args){ ... }) .pack();
These are injected common commands that can also be used with this widget.
Border
Height
Relief
Width
XScrollCommand
XView
YScrollCommand
YView
Additional events that can also be bound to using the bind method.
<<PrevWindow>>, <Alt-Key>, <Key-F10>, <Key-Tab>,
Canvas widgets implement structured graphics. A canvas displays any number of items, which may be things like rectangles, circles, lines, and text. Items may be manipulated (e.g. moved or re-colored) and commands may be associated with items in much the same way that the bind command allows commands to be bound to widgets.