LuaStyle .width[RW] | .height [RW] | .column_alignments
LuaStyle .width[RW] | .height [RW] | .column_alignments
Hello
In LuaStyle, it is possible to define the maximum and minimum height or width.
But there is no way to set or get the value of height or width.
Would it be possible to add .width [RW] and .height [RW] in LuaStyle ?
For example, currently the only way to set a fixed height is to put
maximum_height and minimum_height at the same value.
in the same way, If two columns of a table have different heights, the alignment of the smaller column will be centered in height
.column_alignments is read-only. Is it normal behavior? And reading does not seem to work.
If the method was in [RW] this would fix a lot of positional problem.
In LuaStyle, it is possible to define the maximum and minimum height or width.
But there is no way to set or get the value of height or width.
Would it be possible to add .width [RW] and .height [RW] in LuaStyle ?
For example, currently the only way to set a fixed height is to put
maximum_height and minimum_height at the same value.
in the same way, If two columns of a table have different heights, the alignment of the smaller column will be centered in height
.column_alignments is read-only. Is it normal behavior? And reading does not seem to work.
If the method was in [RW] this would fix a lot of positional problem.
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
No, that's not a supported property - styles only define min and max values. Additionally the current width/height of a GUI element isn't part of the game state and as such isn't MP/replay safe so mods aren't allowed to read it from LuaGuiElements.Angamara wrote:Would it be possible to add .width [RW] and .height [RW] in LuaStyle ?
It is read/write. It's a LuaObject just like LuaStyle. You can't directly assign a value to it just like you can't do "game.player = ..." but you can do: "game.player.position = ..."Angamara wrote:.column_alignments is read-only. Is it normal behavior? And reading does not seem to work.
If the method was in [RW] this would fix a lot of positional problem.
You read it, then modify things on it.
If you want to get ahold of me I'm almost always on Discord.
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
It works like this:Angamara wrote:column_alignments is read-only. Is it normal behavior? And reading does not seem to work.
If the method was in [RW] this would fix a lot of positional problem.
Code: Select all
local widget = gui.add{type = "table", colspan = 2}
widget.style.column_alignments[1] = "left"
widget.style.column_alignments[2] = "right"
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
Rseding91 wrote:No, that's not a supported property - styles only define min and max values. Additionally the current width/height of a GUI element isn't part of the game state and as such isn't MP/replay safe so mods aren't allowed to read it from LuaGuiElements.Angamara wrote:Would it be possible to add .width [RW] and .height [RW] in LuaStyle ?
I do not understand how this property does not support. It is clearly supported.
If I want to give a fixed width to a table. I just need to do
.table.style.minimal_width = 245
.table.style.maximal_width = 245
I do not see what prevents from having this shorter version
.table.style.width = 245
Thanks you, I did not understand its use, now yesRseding91 wrote:It is read/write. It's a LuaObject just like LuaStyle. You can't directly assign a value to it just like you can't do "game.player = ..." but you can do: "game.player.position = ..."Angamara wrote:.column_alignments is read-only. Is it normal behavior? And reading does not seem to work.
If the method was in [RW] this would fix a lot of positional problem.
You read it, then modify things on it.
If I said that it was read-only it's because it's written like that in the documentation.
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
After this :Klonan wrote: It works like this:
Code: Select all
local widget = gui.add{type = "table", colspan = 2} widget.style.column_alignments[1] = "left" widget.style.column_alignments[2] = "right"
Code: Select all
gui.add{type = "table", name = "table", colspan = 2}
gui.table.add{type = "table", name = "row_1", colspan = 1}
gui.table.add{type = "table", name = "row_2", colspan = 1}
Code: Select all
gui.table.style.column_alignments[1] = "top-left"
gui.table.style.column_alignments[2] = "top-left"
gui.table.style.column_alignments.row_1 = "top-left"
gui.table.style.column_alignments.row_2= "top-left"
I thought I understood with the examples but apparently no. What's wrong with my code?
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
It doesn't work like that, you can only set column alignments, not any alignment or rowsAngamara wrote:After this :Klonan wrote: It works like this:
Code: Select all
local widget = gui.add{type = "table", colspan = 2} widget.style.column_alignments[1] = "left" widget.style.column_alignments[2] = "right"
I Try thisCode: Select all
gui.add{type = "table", name = "table", colspan = 2} gui.table.add{type = "table", name = "row_1", colspan = 1} gui.table.add{type = "table", name = "row_2", colspan = 1}
Nothing changes, the smaller column is not aligned at the top.Code: Select all
gui.table.style.column_alignments[1] = "top-left" gui.table.style.column_alignments[2] = "top-left" gui.table.style.column_alignments.row_1 = "top-left" gui.table.style.column_alignments.row_2= "top-left"
I thought I understood with the examples but apparently no. What's wrong with my code?
The only usage is the way my example showed
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
I use the word "row" to name the table, it may be a bad word choice but it does not change your example. I would call them "frog" or "carrot".Klonan wrote: It doesn't work like that, you can only set column alignments, not any alignment or rows
The only usage is the way my example showed
Your example is identical to mine.
Far from the idea of insisting, but are we talking about the same thing?
I want to manage the height alignment as specified in the definition of "Alignment" in the documentation
here is an image for what I want to do.Concepts.html#Alignment wrote: Alignment
A string that specifies where a gui element should be.
Possible values are:
"top-left"
"middle-left" or just "left"
"bottom-left"
"top-center"
"middle-center" or just "center"
"bottom-center"
"top-right"
"middle-right" or just "right"
"bottom-right"
*row1 and row2 are table
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
Align top and bottom just doesn't work for tables at this time,Angamara wrote:I use the word "row" to name the table, it may be a bad word choice but it does not change your example. I would call them "frog" or "carrot".Klonan wrote: It doesn't work like that, you can only set column alignments, not any alignment or rows
The only usage is the way my example showed
Your example is identical to mine.
Far from the idea of insisting, but are we talking about the same thing?
I want to manage the height alignment as specified in the definition of "Alignment" in the documentation
here is an image for what I want to do.Concepts.html#Alignment wrote: Alignment
A string that specifies where a gui element should be.
Possible values are:
"top-left"
"middle-left" or just "left"
"bottom-left"
"top-center"
"middle-center" or just "center"
"bottom-center"
"top-right"
"middle-right" or just "right"
"bottom-right"
*row1 and row2 are table
The only align that works is left/right/center
The alignment is for the entire column in the table, and are indexed only by numbers
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
Klonan wrote:Align top and bottom just doesn't work for tables at this time,
The only align that works is left/right/center
The alignment is for the entire column in the table, and are indexed only by numbers
Ok I understand better as well. The documentation is just incomplete.
I guess an improvement of the GUI system is already planned for 0.16
And so it is not necessary to ask for this fix?
Re: LuaStyle .width[RW] | .height [RW] | .column_alignments
relevant to : viewtopic.php?f=28&t=47087&p=317931#p317926
Thank you posila for this additional information. but it's still fuzzy about using column_alignments.
Same with Klonan's examples. I do not see what is aligned.
posila what do you mean when you say that column_alignments returns a table in writing?
column_alignments [1] Do they match column 1, column_alignments [2] in column 2, and so on?
What is the effect of "right" for example with column_alignments [2] = "right"?
What can be the elements on which column_alignments to an impact?
Is it possible to have a complete example with a container that has visible aligned elements. ?
Thank you posila for this additional information. but it's still fuzzy about using column_alignments.
Same with Klonan's examples. I do not see what is aligned.
posila what do you mean when you say that column_alignments returns a table in writing?
column_alignments [1] Do they match column 1, column_alignments [2] in column 2, and so on?
What is the effect of "right" for example with column_alignments [2] = "right"?
What can be the elements on which column_alignments to an impact?
Is it possible to have a complete example with a container that has visible aligned elements. ?