Skip to main content
Participating Frequently
November 20, 2021
Answered

SDK: Dialog: Variable number of rows in group_box

  • November 20, 2021
  • 1 reply
  • 325 views

[SDK] I need to present a dialogbox with a variable number of rows - I don't know beforehand how many rows there will be. I can't figure out how to do this.

If I do something like 

local groupBox = f:group_box{}

and then use table.insert to add f:row elements I end up with an empty container.

I read somewhere in the manual: "To create the containment hierarchy, use the view factory to create a container, and within that call, use it to create the child containers and controls:" Does that mean that what I want is not possible?

I hope someone can help me out 🙂

 

 

Correct answer johnrellis

Here's how to do it:

local rows = {}
for i = 1, n do
    table.insert (rows, f:static_text {title = "Row " .. i})
    end
rows.title = "Group Box Title"
local box = f:group_box (rows)

1 reply

johnrellis
johnrellisCorrect answer
Legend
November 20, 2021

Here's how to do it:

local rows = {}
for i = 1, n do
    table.insert (rows, f:static_text {title = "Row " .. i})
    end
rows.title = "Group Box Title"
local box = f:group_box (rows)
Participating Frequently
November 21, 2021

Thank you, master  🙂