Is there enable/disable functionality in ETO?

I’ve come a long way with ETO in the last couple of weeks, thanks mostly to examples provided by @Terry_Chappell. Thanks Terry for all your help.

I do have one (perhaps final) question, but I don’t want to keep bugging Terry, so I’ll throw this out there.

Is there a way to enable and/or disable items on the form? I’ve not yet seen an example of that.

Here is an example from an old VB6 project that demonstrates what I’m talking about:

Thanks,

Dan

1 Like
someControl.Enabled = false;
someControl.Enabled = true;

Remember to do that on the app.Invoke(), where app is your Eto.Forms.Application instance.

In an F#/Eto app I have lines like these:

[<EntryPoint>]
[<STAThread>]
let main _ = 

    Eto.Platform.Initialize(Eto.Platforms.Wpf)

    let app = new Application()

    let appinv (f) =
      app.Invoke(fun _ -> f()) |> ignore

    /// In some code later on, triggered on clicking
    /// the button processclick.
    appinv (fun () ->
              processclick.Enabled <- false
              cleanclick.Enabled <- false
              cancelclick.Enabled <- true
    )


1 Like

Dan,

For example in our Python script, use:

n_combobox.Enable = False

to grey out this control. And

n_combobox.Enabled = True

to re-enable it.

Regards,
Terry.

1 Like

n_combobox.Enabled = True

1 Like

Updated above and added Python context.

1 Like

Thanks guys. Like usual, I was over complicating this in my head.

Dan