IupCanvas
Creates an interface element that is a canvas - a working area for your application.
Parameters/Return
Ihandle* IupCanvas(char *action); [in C] iupcanvas{} -> (elem: iuplua_tag) [in IupLua3] iup.canvas{} -> (elem: iuplua_tag) [in IupLua5] canvas(action) [in LED]action: Name of the action generated when the canvas needs to be redrawn.
This function returns the identifier of the created canvas, or NULL if an error occurs.
Attributes
BGCOLOR: Background color. In Windows the default value is "TRANSPARENT" which does not means that the canvas is transparent, but it means that the aplication will draw its contents. This will avoid unnecessary redraws of the canvas. For better results use also the attribute CLIPCHILDREN=YES in the dialog.
CURSOR: Canvas cursor.
SIZE: Size of the canvas. Default: size of one character.
SCROLLBAR: Associates a horizontal and/or vertical scrollbar to the canvas.
DX: Size of the thumb in the horizontal scrollbar.
DY: Size of the thumb in the vertical scrollbar.
POSX: Position of the thumb in the horizontal scrollbar.
POSY: Position of the thumb in the vertical scrollbar.
XMAX: Maximum value of the horizontal scrollbar.
XMIN: Minimum value of the horizontal scrollbar.
YMIN: Minimum value of the vertical scrollbar.
YMAX: Maximum value of the vertical scrollbar.
BORDER: Shows a border around the canvas. It can only be changed before the element is mapped. This attribute does not work on Motif.
EXPAND: The default value is YES, filling every possible space.
CONID: Identifier of the canvas for GKS/puc.
DRAWSIZE: The size of the drawing area in pixels. In Motif this is identical to RASTERSIZE. In Windows it is obtained from the canvas client area since it may contains a border.
Callbacks
ACTION: Action generated when the canvas needs to be redrawn. Also receives as parameters the scrollbar position:
int function(Ihandle *self, float x, float y); [in C] elem:action(x, y: number) -> (ret: number) [in IupLua]x: Thumb position in the horizontal scrollbar.
y: Thumb position in the vertical scrollbar.This action is also generated right after the dialog is viewed by means of functions IupShow, IupShowXY or IupPopup.
BUTTON_CB: Action generated when any mouse button is pressed or released.
ENTERWINDOW_CB: Action generated when the mouse enters the canvas.
LEAVEWINDOW_CB: Action generated when the mouse leaves the canvas.
MOTION_CB: Action generated when the mouse is moved.
KEYPRESS_CB: Action generated when a key is pressed or released.
RESIZE_CB: Action generated when the canvas' size is changed.
SCROLL_CB: Called when the scrollbar is manipulated.
MAP_CB: Called right after the element is mapped.
WOM_CB: Action generated when an audio device receives an event.
WHEEL_CB: Action generated when the mouse wheel is rotated.
Note
Note that some keys might remove the focus from the canvas. To avoid this, return IGNORE in the K_ANY callback.