This is my GUI API. I made it so that making GUI's could be done fast without sacrificing quality. It comes with very many useful functions. It has an OOP design to it with regards to the way it handles buttons.

I also included a GUIBuilder Program that helps in creating GUI's. It is taken from my [post='http://www.computercraft.info/forums2/index.php?/topic/21610-goldslide-v10-keynotepowerpoint-in-minecraft-wip/']GoldSlide[/post] program. It displays the x,y,w,h variables for creating buttons. This saves lots of time.

Global Functions
Spoiler
function clear()
SpoilerThis is a very self explanatory and basic clear function. It is common practice to never use shell.run("clear") to clear the terminal




function inputFeild(x,y,text,maxL,bgColor,character)
SpoilerThis is a very useful advanced read function. The x and y variables are the x and y coordinates of the input field.
The text variable is the text to be edited (if you are just using it as a read function just put "").
The variable maxL is what separates this function from the regular read function. It limits the end of the visible input so you create little text boxes.
The variable bgColor is the background color.
The variable character is optional. It is the same as read("*"). It is mainly for creating password text boxes.





function newButton(x,y,w,h,title,color,display)
SpoilerThis is the main reason I created this API.
This function returns a button table object and draws it on the screen.
The variables x and y are the x and y coordinates of the top left hand corner of the button.
The title variable is for use with the waitForButtons function IT IS NOT PRINTED ON THE SCREEN.
The display variable is optional and is used to change the display screen (for example a monitor).





function waitForButtons(...)
SpoilerThis is the event handler for button objects.
It returns the title of the button pressed.
It takes button objects as arguments (as many as you like).





function checkInArray(x,a)
SpoilerSearches for x in array a.




function checkIn2DArray(x,y,a)
SpoilerSearches a 2D Array. It searches for x in a[1] and y in a[1]. (this function is mainly for use with button event handling)






function drawArray(a,startY,fixedW)
SpoilerThis another interesting function. It takes an string array argument a. It creates an array of buttons then prints it to the screen then waits for the user input. It returns the name of the button pressed.
The startY argument is optional. It is used for customizing the start Y coordinate of the printing (if nil then startY equals 3).
fixedW is optional. It is used for customizing the end X coordinate of the printing (if nil then fixedW equals the x value of term.getSize()

Pastebin
Spoiler
pastebin get HyLWHseV gui


GUI Builder Program
Spoiler
pastebin get 2tc6q18p GUIBuilder