IUP/Controls/IupCanvas

From Vendetta Lua
Revision as of 08:58, 9 May 2023 by Draugath (talk | contribs)
Jump to navigationJump to search


Creates an interface element that is a canvas - a working area for your application.

Creation

iup.canvas{} -> (elem: ihandle)
This function returns the identifier of the created canvas, or nil if an error occurs.

Attributes

BGCOLOR: Border color
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.
XMIN: Minimum value of the horizontal scrollbar.
XMAX: Maximum 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. Default: "YES".
EXPAND: The default value is "YES".

Callbacks

ACTION: Action generated when the canvas needs to be redrawn. Also receives as parameters the scrollbar position:
elem:action(x, y: number) -> (ret: number)
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.
SCROLL_CB: Called when the scrollbar is manipulated.
MAP_CB: Called right after the element is mapped.

Note

Note that some keys might remove the focus from the canvas. To avoid this, return IGNORE in the K_ANY callback.