-
My first question: I would like to create childs (If I'm not mistaken, copies of widget) of a widget but i dont know how to do it. I didn't find how to use it. I tried create child with setting parent but It didn't work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Here is a simple example using local lwtk = require("lwtk")
local Application = lwtk.Application
local Column = lwtk.Column
local Row = lwtk.Row
local PushButton = lwtk.PushButton
local TitleText = lwtk.TitleText
local TextLabel = lwtk.TextLabel
local Space = lwtk.Space
local app = Application("example")
local win = app:newWindow {
title = "example",
Column {
id = "column1",
TitleText { text = "Hello World!", style = { textSize = 35 } },
Row {
Space {},
PushButton { id = "button1",
text = "&Add Child" },
Space {}
}
},
}
local childCount = 0
win:childById("button1"):setOnClicked(
function(widget)
local column = widget:byId("column1")
childCount = childCount + 1
column:addChild(TextLabel{
text = "Child "..childCount,
style = { TextAlign = "center" }
})
end)
win:show()
app:runEventLoop() There is no method
lwtk's documentation is work in progress and not completed yet, you can also study the examples. |
Beta Was this translation helpful? Give feedback.
Here is a simple example using
addChild
: