Disable or enable control in ETO form

How would one disable or enable a control on an ETO form? For example based on the state of a checkbox a control would be enabled or disabled for operator input.

Eric

EtoCheckBoxDialog

import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms

class EtoCheckBoxDialog(forms.Dialog[bool]):

    def __init__(self):
        self.Title = 'CheckBox Dialog'
        self.Padding = drawing.Padding(10)
        self.Resizable = False

        self.m_checkbox = forms.CheckBox(Text = "Enable", Checked = True)
        self.m_checkbox.CheckedChanged += self.OnCCheckedChanged

        self.DefaultButton = forms.Button(Text = 'OK')

        layout = forms.DynamicLayout()
        layout.Spacing = drawing.Size(5, 5)
        layout.AddRow(self.m_checkbox)
        layout.AddRow(None)
        layout.AddRow(self.DefaultButton)

        self.Content = layout

    def OnCCheckedChanged(self, sender, e):
        self.DefaultButton.Enabled = self.m_checkbox.Checked

dialog = EtoCheckBoxDialog();
rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

EtoCheckBoxDialog.py (895 Bytes)

Thank you for the fast reply!!! This should work for me.

Eric