Hi,
I have an eto form that consists of a drop down list and a few other fields as well.
How would I make a textbox and label disappear depending on the option selected in the dropdown list?
Hi,
I have an eto form that consists of a drop down list and a few other fields as well.
How would I make a textbox and label disappear depending on the option selected in the dropdown list?
here is a snippet you can try
it’s a much simplified version to give you an idea
you will probably want to do this in a class object with variables as attributes
import Eto.Forms as forms
import Eto.Drawing as drws
from Rhino.UI.RhinoEtoApp import MainWindow as main
def OnClose(s, e):
if dd.SelectedIndex == 0:
layout.Items.Add(forms.Label(Text='just added')) # if you keep clicking yes, this piles on
elif dd.SelectedIndex == 1:
layout.Items.RemoveAt(1) # careful this might throw index errors
w = forms.Dialog()
layout = forms.StackLayout()
layout.Padding = 10
layout.Width = 200
layout.Height = 100
dd = forms.DropDown()
dd.DropDownClosed += OnClose
dd.Items.Add('yes')
dd.Items.Add('no')
layout.Items.Add(dd)
w.Content = layout
w.ShowModal(main)