Eto Form: hide textbox and label depending on value selected in drop down 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)

cool - can this work on a text object, to make the text object this drop down list? and then the result is the text selected from the drop down??

yes. use the “s” parameter of the event handler. i belive that is the drop down menu itself. you can query the SelectedValue property, and use that to assign to the label in my example