Updated Objects (markdown)

Robert Jelic
2022-03-27 18:53:31 +02:00
parent 10d2183261
commit 8710ed71fd

@@ -5,9 +5,9 @@ Screens are the most basic thing you need, to create a GUI. They are basically l
Example on how to create a screen:
````lua
local firstScreen = screen.new("myFirstScreen")
firstScreen:setTitle("First Screen")
firstScreen:showBar()
local firstScreen = screen.new("myFirstScreen")
firstScreen:setTitle("First Screen")
firstScreen:showBar()
````
Only one screen can be active at the same time, this means, if you use firstScreen:show() and you already created another screen, it will automatically hide the old screen
@@ -16,4 +16,33 @@ Here you can see all the methods you can use: Frames
# Frames
here
Frames are like screens or screens are frames. Frames can be sub objects of screens, while screens cannot be sub objects of frames OR screens. This is the only difference between screens and frames. Everything else is the same.
Here are all possible functions you can use with screens and frames:
* screen.new(string) -- creates a new screen object
* frame:addFrame(string) -- creates a new frame object
* frame:setTitle(string) -- sets the title
* frame:setTitleAlign(string) -- sets the title alignment ("left","right","center")
* frame:setPosition(int, int) -- changes the position relative to its parent frame
* frame:setBackground(int) -- changes the background color
* frame:setForeground(int) -- changes the text color
* frame:setSize(int, int) -- changes the size (width, height)
* frame:showBar([bool]) -- shows/hides the bar on top where you will see the title if its active (no args = true)
* frame:isModifierActive(int or string) -- returns true if user is currently holding a key (following strings are possible: "shift","ctrl","alt"), int can be everything computercraft supports
* frame:show() -- shows the frame on the screen
* frame:hide() -- hides the frame
* frame:remove() -- removes the frame completly
* frame:getObject(string) - gets an created object (arg = id)
* frame:removeObject(string) - removes the object with the id
* frame:addObject(object) -- you can add a object manually, normaly you shouldn't use this function, it gets called internally
* frame:drawObject() -- this draws the frame, you dont need that function, it gets called internally
* frame:mouseEvent(string,int,int,int) -- internal mouse event, better don't use it, i created mouse hooks for you
* frame:keyEvent(string,int) -- internal keyevent, better don't use it, i created key hooks for you
* frame:changeZIndexOfObj(object, int) -- changes the z index of an object
* frame:setFocusedElement(object) -- changes the currently focused element
* frame:removeFocusedElement(object) -- removes the focus of the currently focused element
* frame:getFocusedElement() -- gets the currently focused element
* frame:getFocusEvent() -- event which gets fired when the frame gets the focus -- its more for internal usage
* frame:setMoveable(bool) -- sets if the frame should be moveable or not (to move the frame you need to drag it on the top bar