buttonAPI.newText({}) returns a new textbox. parameters are provided as a table:
xandy: the strating position - requiredwidthandheightof the textbox - requiredtextthe text displayed in the textpox - required every parameter can be a function with the following signaturefunction(element, termx, termy)wheretermxandtermyare the size of the terminal.
buttonAPI.new({}) returns a new button. parameters are provided as a table:
xandy: the starting position - requiredwidthandheightof the button - requiredtext: the button label - defaults to ""textColor: the color of the label - defaults to blackbackgroundColor: the color of the backgroudn - defaults to whiteisSticky: if this button shall be drawn on the viewport or on the panel behind the viewport - defaults to falseisVertical: if the text shall be printed vertical or horizontal - defaults to falsecallback: the callback function which will be called if the button is clicked - defaults to nil every parameter can be a function with the following signaturefunction(element, termx, termy)wheretermxandtermyare the size of the terminal.
a label is basically a textbox which redirects clicks to an associated button
buttonAPI.newLabel({}) returns a new label. parameters are provided as a table:
xandy: the starting position - requiredwidthandheightof the button - requiredtextthe text displayed in the textpox - requiredbuttona button - required every parameter can be a function with the following signaturefunction(element, termx, termy)wheretermxandtermyare the size of the terminal.
buttonAPI.anchorTopcan be used asxto but a button on the first line on the terminalbuttonAPI.anchorBottomcan be used asxto but a button on the last line of the terminalbuttonAPI.anchorLeftcan be used asyto but a button on the first column of the terminalbuttonAPI.anchorRightcan be used asyto but a button on the last column of the terminalbuttonAPI.width(percent)can be used aswidthto draw a button withpercentof the screen widthbuttonAPI.maxWidthis an alias forbuttonAPI.width(1)which gets a width of 100% of the screen widthbuttonAPI.height(percent)can be used asheigthto draw a button withpercentof the screen heightbuttonAPI.maxHeighis an alias forbuttonAPI.height(1)which gets a height of 100% of the screen height
button = buttonAPI.new({
x = 3,
y = 1,
width = buttonAPI.maxWidth,
heigth = 2,
text = "button",
isSticky = true,
textColor = colors.green
})