IUP/Controls/IupCanvas

From Vendetta Lua
Revision as of 06:13, 11 May 2023 by Draugath (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

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.
SCROLLBARSIZE: number
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".
TABSTOP: Possible values: "YES", "NO"
CANVASLINES
MOUSECLICKSOUND
LINEX: number
XSTYLE: number
COLORPICKERMODE: Possible values: "ON", "OFF"

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. This event triggers twice.
LEAVEWINDOW_CB: Action generated when the mouse leaves the canvas. This event triggers twice.
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.

Note

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