Elius94 / console-gui-tools

A simple library to draw option menu or other popup inputs and layout on Node.js console.
MIT License
106 stars 17 forks source link

Elius94/issue6 #46

Closed Elius94 closed 1 year ago

Elius94 commented 1 year ago

Button ⇐ Control

Kind: global class
Extends: Control

new Button(id, text, width, height, x, y, style, visible, enabled, onClick, onRelease)

This class is an overload of Control that is used to create a button.

Button

Emits the following events:

Param Type Description
id string

The id of the button.

text string

The text of the button.

width number

The width of the button.

height number

The height of the button.

x number

The x position of the button.

y number

The y position of the button.

style ButtonStyle

To set the style of the button.

visible boolean

If the button is visible. Default is true (make it hide using hide()).

enabled boolean

If the button is enabled. Default is true (make it disabled using disable()).

onClick function

The function to call when the button is clicked.

onRelease function

The function to call when the button is released.

Example

new Button("btnRun", "Run me!", 10, 3, 21, 18, 
     { 
         color: "magentaBright", 
         bold: true, 
         italic: true,
         borderColor: "green"
     },
     () => {
         GUI.log("Button clicked!")
     })