0904
May 18, 2023, 11:07pm
1
Hi All,
def __init__(self):
self.Title = "Title"
self.Size = Eto.Drawing.Size(150, 100)
self.Button0 = Eto.Forms.Button(Text = 'ONE')
self.Button1 = Eto.Forms.Button(Text = 'TWO')
layout = Eto.Forms.DynamicLayout()
layout.AddRow(self.Button0)
layout.AddRow(self.Button1)
self.Content = layout
self.Size = Eto.Drawing.Size(150, 100)
Eto.Drawing.Size width 150 and height 100
what value to put to have the same height in the two Buttons?
ps Eto objects have a standard height?
Just add an empty row to your layout:
layout.AddRow(None)
alternatively, you can add this:
layout.AddSpace()
Yes, the height depends on the content and the styling like padding etc. You can control button heights individually eg:
self.Button0 = Eto.Forms.Button(Text = 'ONE', Height=40)
self.Button1 = Eto.Forms.Button(Text = 'TWO', Height=50)
To prevent that you need to change your dialog height so it fits the height of the content, you can define the dialog Size (it’s height) like this:
self.Size = Eto.Drawing.Size(150, -1)
_
c.
2 Likes
0904
May 23, 2023, 12:27pm
4
sorry @clement ,
layout.AddRow(None)
layout.AddRow(None)
or
layout.AddSpace()
layout.AddSpace()
can’t you add consecutive spaces?
Hi @0904 ,
i guess you have more control over spacing and padding per row if you use AddSeparateRow . Below is an example which shows how to use it in your case.
ETO_AddSeparateRow.py (1.2 KB)
Note that you must pass in controls in this line as list:
[self.Button_A, self.Button_B]
but you can also create an empty (separate) row by using this instead for the list of controls:
[None]
You can change the distance from previous controls for this row by adjusting the padding values eg.
Eto.Drawing.Padding(left, top, right, bottom)
There is a good document about Eto layouts here .
_
c.
1 Like
0904
May 23, 2023, 11:00pm
6
clement:
You can change the distance from previous controls for this row by adjusting the padding values eg.
Eto.Drawing.Padding(left, top, right, bottom)
Hi @clement ,
great suggestions thanks for reply.
that’s why I asked if the controls have a standard height by default (or a way to know the height and width of a control) so that, if there was a need to align the various controls with the heights, knowing the dimensions, distances and spaces between the controls in the layout, it would be possible to align them perfectly