Static VERSIONcanvasGUI version
true if this gui can respond to mouse/key events
true if gui rendering is allowed
Get the control given it's unique name.
get the associated control
unique ID for the control to find
Adds a new color scheme to those already available. It does not replace an existing scheme.
this gui instance
the color scheme
Create a button control
a button
unique id for this control
Optional x: numberleft-hand pixel position
Optional y: numbertop pixel position
Optional w: numberwidth
Optional h: numberheight
Get or set the default corner radii used in this GUI.
To set the radii the parameters must be one of the following
If no parameter is passed or does not match one of the above then an array of the currently used radii values.
an array of the currently used radii values
Rest ...c: anyvalid radii combination
This will create a new color scheme from an existing one. The returned scheme is a deep-copy of the source scheme and should be edited before adding it to the GUI with the addScheme(...) method. The name of the new scheme is specified in the first parameter and cannot be changed later.
The method will fail if -
the new color scheme or null if unable to create it.
a unique name for the new color scheme.
the name of the source scheme.
If the [x, y] display position is over a controls pick region then return an object containing the 'control' and the pick region ('part') number.
an object containing the control hit and the control part number
horizontal pixel location
vertical pixel location
Get a grid layout for a given pixel position and size in the display area. Initially the grid repreents a single cell but the number and size of horizontal and vertical cells should be set before creating the controls.
the grid layout
left edge position
top edge position
grid width
grid height
Create a side pane. The pane location is either 'north', 'south', 'east' or 'west'.
The pane will fill the whole width/height of the canvas depending on its position. The user controls how far the pane extends into the canvas when open.
a side pane
unique id for this control
the pane position ('north', 'south', 'east' or 'west')
the maximum depth the pane expands into the canvas
Display the control pick buffer in a canvas element with the given id. If there is no HTML element with this id or if it is not a canvas element a new canvas element will be created and appended to the body section.
Every control that can respond to mouse, touch or pointer events is given a unique pick color when it is created. The control is drawn on the pick buffer using the pick color and the color under the event's XY position identifies the control to handle it.
the id of a canvas element
Sets or gets the global text font.
If the parameter is a true-type-font or the name of a system font it will be used as the global font and this gui will be returned.
Recognised font names are :-
'arial' 'verdana' 'tahoma' 'trebuchet ms' 'times new roman' 'georgia' 'courier new' 'brush script mt' 'impact' 'serif' 'sans-serif' 'monospace'
Invalid fonts are ignored and the global font is unchanged.
If no parameter is passed then the current font is returned.
this gui
Optional gtf: anyA true-type-font or the name (case-insensitive) of a valid system font.
Sets or gets the global text style.
The 4 recognised font styles are :-
NORMAL BOLD ITALIC BOLDITALIC
Unrecognized styles are ignored and the global style is unchanged.
If no parameter is passed then the current style is returned.
this gui
Optional gty: stringthe font style to use.
Create a single line text input control
a textfield
unique id for this control
Optional x: numberleft-hand pixel position
Optional y: numbertop pixel position
Optional w: numberwidth
Optional h: numberheight
Sets or gets the global tip text size. If no parameter is passed then the global tip text size is returned otherwise it returns this control
the global tip text size or this control
Optional gtts: numbernew global tip text size
Controls how long a tooltip is shown and how long to wait before it can be shown again. This helps avoid the tip flicking on and off as the mouse moves over the control.
this gui
show duration (ms)
duration before the tip can be shown again
Static $$Get the GUI with the given name. If no such GUI exists then the function returns undefined.
The global function getGUI(...) is an alternative method that accepts the same parameters performs exactly the same task.
the matching GUI controller or undefined if not found.
the name of the GUI to get
Static createCreates and returns a named GUI controller.
If a GUI with this name already exists it will be returned, otherwise a new GUI will be created and returned.
If the name parameter is not of type 'string' or an empty string then a randomly generated name will be used instead.
The global function createGUI(...) accepts the same
parameters is the preferred method to create a GUI.
a GUI controller existing or new GUI with the given name.
unique name for the GUI
the renderer - the display canvas
the processing instance (required in Instance mode)
Static getCreates and returns a named GUI controller.
This method is included for compatibility with canvasGUI V1 and has
beed deprecated. The createGUI(...) method should be used
instead as it fits the p5.js scheme of using create???(...)
methods when an object instance is being initiated.
To remain compatible with canvasGUI V2 where every GUI requires a unique name, a randomly generated name will be used.
a GUI controller existing or new GUI with the given name.
the renderer - the display canvas
the processing instance (required in Instance mode)
Static getCreates and returns a named GUI controller.
This method is included for compatibility with canvasGUI V1 and has
beed deprecated. The createGUI(...) method should be used
instead as it fits the p5.js scheme of using create???(...)
methods when an object instance is being initiated.
a GUI controller if valid name provided
unique name for the GUI
the renderer - the display canvas
the processing instance (required in Instance mode)
Generated using TypeDoc
Core class for the canvasGUI library
Use an instance of GUI (the controller) to control all aspects of your gui.