Hi i cant see this mentioned anywhere so i must be going about it wrong (except it nearly works).
so im trying to make an eto form dynamic layout that might change the amount of rows it has depeneding on, in this case, the number of layers in a file (but for now its just a list i created at the end of the script).
i can get each of the layers on their own seperate row, but i cant seem to get the controls to follow suit.
i feel like i either need to make the control variables a method in the class (which i tried to and failed at) or im going about this in completely the wrong way, considering this is my first ever Eto form i feel its the latter.
can anyone help?
import Rhino.UI import Eto.Drawing as drawing import Eto.Forms as forms class Material_assigner(forms.Dialog[bool]): def __init__(self, material_names, layer_names):##setting up the eto form self.Title = "Material Assigner" self.Padding = drawing.Padding(10) self.Resizable = False self.checkbox = forms.CheckBox( Text = "Consider?") ##check boxes (always true to assume u want to calculate every layer self.checkbox.Checked = True self.dropdown = forms.ComboBox() ##dropdown menu you can edit self.dropdown.DataStore = material_names self.dropdown.SelectedIndex = 0 self.DefaultButton = forms.Button(Text = 'OK') self.DefaultButton.Click += self.OnOKButtonClick self.AbortButton = forms.Button(Text = 'Cancel') self.AbortButton.Click += self.OnCloseButtonClick self.selectbutton = forms.Button(Text = "Select") ##want to add a "select" button so you dont need to use layers if u dont want to layout = forms.DynamicLayout() layout.Spacing = drawing.Size(5,5) for layer in layer_names: layout.AddRow(None) layout.AddRow(layer, self.checkbox, self.dropdown, self.selectbutton)#u can just chuck strings in layouts and it acts like a lable layout.AddRow(None) layout.AddRow(self.DefaultButton, self.AbortButton) self.Content = layout def OnOKButtonClick(self, sender, e): self.Close(True) def OnCloseButtonClick(self, sender, e): self.Close(False) def test(materials, layers): test = Material_assigner(materials, layers); rhinowindow = test.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow) test(["material 1", "material 2"], ["layer 1", "layer 2", "layer 3"])
Thanks a bunch in advance, im pretty stuck