Page 1 of 1

Gui: Set the width of a column in a table

Posted: Wed Nov 13, 2024 2:12 pm
by picklock
I am trying to set the width of a column in a table within my gui. I get the error message: xxy

I have tried to implement it with the following code:

Code: Select all

local myFrame = myGui.add{
type = "frame",
style = "inside_shallow_frame",
}.add{
	type = "table",
	style = "bordered_table",
	column_count = 3,
}
myFrame.style.column_alignments[3] = "right" --this works
myFrame.style.column_widths[3] = 200 --this throws error: LuaStyle doesn't contain key column_widths.
Now I'm a bit confused because setting the alignment with column_alignments works. But with the column_widths I used to set the column width I get the above error message. Both properties I used are from the TableStyleSpecification of the API Docs. I assumed that both properties can be called in the same way.
What am I doing wrong?

Re: Gui: Set the width of a column in a table

Posted: Wed Nov 13, 2024 2:39 pm
by BraveCaperCat
picklock wrote: Wed Nov 13, 2024 2:12 pm I am trying to set the width of a column in a table within my gui. I get the error message: xxy

I have tried to implement it with the following code:

Code: Select all

local myFrame = myGui.add{
type = "frame",
style = "inside_shallow_frame",
}.add{
	type = "table",
	style = "bordered_table",
	column_count = 3,
}
myFrame.style.column_alignments[3] = "right" --this works
myFrame.style.column_widths[3] = 200 --this throws error: LuaStyle doesn't contain key column_widths.
Now I'm a bit confused because setting the alignment with column_alignments works. But with the column_widths I used to set the column width I get the above error message. Both properties I used are from the TableStyleSpecification of the API Docs. I assumed that both properties can be called in the same way.
What am I doing wrong?
Not reading the docs properly.
This doesn't work:

Code: Select all

myFrame.style.column_widths[3] = 200
But this should:

Code: Select all

myFrame.style.column_widths[3].width = 200

Re: Gui: Set the width of a column in a table

Posted: Wed Nov 13, 2024 3:20 pm
by picklock
BraveCaperCat wrote: Wed Nov 13, 2024 2:39 pm Not reading the docs properly.
This doesn't work:

Code: Select all

myFrame.style.column_widths[3] = 200
But this should:

Code: Select all

myFrame.style.column_widths[3].width = 200
Thanks for the quick reply.

Oh yes, I have read the documentation and also tried the code you suggested. The error occurred there too. Somehow it doesn't seem to recognise the property column_widths.

I have also tried it individually with the following lines. The result was always negative.

Code: Select all

myFrame.style.column_widths[3].minimal_width = 200
myFrame.style.column_widths[3].maximal_width = 200