lewark / gui.lua Goto Github PK
View Code? Open in Web Editor NEWGUI toolkit for ComputerCraft
License: MIT License
GUI toolkit for ComputerCraft
License: MIT License
If possible, I'd like to add the following widgets:
Parameters to method calls are not checked for correct type, resulting in confusing situations as seen in #1. Adding calls to cc.expect
in each API method validating the parameters would resolve this issue.
Also, because this module contains classes, it might be good to add an expectClass
function that checks using Object:instanceof
.
Currently, little documentation is provided on the API beyond the demo.lua
script. It would be helpful to document the behavior and parameters of each method, especially for complicated methods like LinearContainer:addChild
.
I wrote a gui, just to try if I can create an installer. But every time I got an error gui.lua:291: attempt to index local 'child' (a nil value)
I can not fix this, because I am not so good at lua. But your code demo.lua
works. Help, please.
Here is the code:
local gui = require('gui')
local root = gui.Root:new()
local box = gui.LinearContainer:new(root,2,1,1)
--local box2 = gui.LinearContainer:new(root,1,0,0)
local lbl = gui.Label:new(root,"Hello!")
local btn1 = gui.Button:new(root,"Button 1")
local btn2 = gui.Button:new(root,"Button 2")
local btn3 = gui.Button:new(root,"Big Btn.")
--local field = gui.TextField:new(root,5,"TextField")
--local area = gui.ListBox:new(root,10,10,{})
--local sb = gui.ScrollBar:new(root,area)
--for i=1,64 do
-- table.insert(area.items,"Item "..tostring(i))
--end
btn1.enabled = false
function btn1:onPressed()
lbl.text = "Pressed"
root:onLayout() -- redraw entire screen
end
function btn2:onPressed()
btn1.enabled = true
btn1.dirty = true
end
--root:addChild(box2)
--box2:addChild(area,true,true,gui.LinearAlign.START)
--box2:addChild(sb,false,true,gui.LinearAlign.START)
--box2:addChild(box,false,true,gui.LinearAlign.START)
box:addChild(lbl,false,false,gui.LinearAlign.START)
box:addChild(btn1,false,false,gui.LinearAlign.START)
box:addChild(btn2,false,false,gui.LinearAlign.START)
box:addChild(field,false,true,gui.LinearAlign.START)
box:addChild(btn3,true,true,gui.LinearAlign.START)
root:mainLoop()
If the text in a Label becomes shorter, then residue is left behind
Documentation generator should search directories recursively.
It might also be good to move the script to a separate repository.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.