Skip to content

Area

The area is an input element and defines an active zone on the screen to manage touch.

It is normally not used directly, but indirectly by the other elements.

Configure

Warning

Ensure the GUI library is included and initialised according to the configuration procedure.

Area myArea(&myGUI);

The constructor Area() creates an area and sets the link to the GUI myGUI.

1
2
myArea.dDefine(10, 10, 80, 50,
    0x0001);

dDefine() defines the area with vector coordinates.

The required parameters are

  • The first line specifies the vector coordinates: top-left coordinates x-y then width and height in pixels;

The optional parameters are

  • The second line is optional and sets the index, by default 0x0000.

By default, the area is enabled according to the GUI setting.

Then,

myArea.setState(stateDisabled);

setOption() has no impact on an area.

setState() defines whether touch is enabled for the element.

Select

  • stateDisabled or false for touch disabled;

  • stateEnabled or true for touch enabled.

Note

Use literals instead of values for upward compatibility.

Default is false for touch disabled.

Use

bool result = myArea.check();

if the area is enabled,

  • check() returns whether the area is touched.

  • getState() returns the state of touch.

Example

No example is provided, as the area element is normally not used directly, but indirectly by the other elements.