ETO forms and list box

Hi if I add a list box to an ETO form I can populate the list box with pre defined text but I would like to add a list box and populate it with the Layers of the open Rhino file.
Can anyone please advise me as to how I could / would do this.

you can iterate through them like so:

import Rhino
for l in Rhino.RhinoDoc.ActiveDoc.Layers:
    print(l.Name)
    print(l.Color)

layer properties you can get are such:
ApiDocs.co · RhinoCommon · Layer Properties

Hi Will I’m afraid this doesn’t answer my question as I don’t know how to populate the list box on the ETO form as the focus only goes to Rhino to get this data once the form is closed. Maybe I have missed something but I thought the ETO forms are modal and only continued after closing so how do I get the Rhino data into my UI as the rest of the form is populated manually at the start of the script.

Hi Will ,

See the screenshot below, I can populate the list box with pre defined info okay but how do I get the layer info from Rhino at this stage to populate a drop down of all the layers as it doesn’t seem to interact with Rhino until it is Clicked as OK and the form closes.

you run those lines before calling the modal, and add each with the following
yourdropdown.Items.Add(l.Name)

Think I understand now, it’s not easy dealing with idiots but you are doing a great job of it. Many thanks

:joy: no problem
we are all students, at different stages

I’ve been in the same class for over 20 years