- Joined
- Nov 27, 2015
- Messages
- 556
- Reaction score
- 794
- First Language
- English
- Primarily Uses
- RMMV
Hey guys, I'm wondering how formulas work in depth.
I'm trying to use formulas to generate the properties of the UI elements, such as the text on buttons, but they don't seem to do anything to the current UI.
It works for simple properties like text in ui.Text, but when I use them on buttons there is no response.
Here's the code I'm working with as an example:
I really want to be able to dynamically update bits and pieces of the UI I'm building, but that doesn't seem to be a possibility here. It's all very static for me.
I'm trying to use formulas to generate the properties of the UI elements, such as the text on buttons, but they don't seem to do anything to the current UI.
It works for simple properties like text in ui.Text, but when I use them on buttons there is no response.
Here's the code I'm working with as an example:
PHP:
controls: [
{
type: "ui.Text",
text: "Categories :",
font: { "name": "Tahoma", size: 32},
sizeToFit: true,
frame:[0, 0, "19%", "70%"],
margin: [10, 10, 0, 10]
},
{
type: "ui.Button",
params:{text: "Category"},
action: {name:"amaEmit", params:{name:"categoryClick", data: `${"Category"}`}},
resizable: true,
categoryName: "Test",
margin: [0, 0, 0, 10]
},
{
type: "ui.Button",
params:{text: {}},
action: {name:"amaEmit", params:{name:"categoryClick", data: `${"Category"}`}},
formulas: [$(()=> o.params = {
text: `${amryl.unique($dataFields.database.librarium.map(x => x.category ))[o.index - 1]}`
})
],
resizable: true,
categoryName: "Test",
margin: [0, 0, 0, 10]
}
]

