EditListBox and OrderListBox in Rhino 7

Hello,

In Rhino script 6 it was possible to create controls allowing you to add, delete and move the entry of a list.

https://developer.rhino3d.com/api/rhinoscript/user_interface_methods/orderlistbox.htm
or
https://developer.rhino3d.com/api/rhinoscript/user_interface_methods/editlistbox.htm

I can’t find the corresponding control in the Rhino 7 API, either with RhinoScript or RhinoCommon.
Does anyone know the name of the Eto.Form control?

merci,
jmv

Hi,
It sounds like you could use a TreeGridView

self.m_treegridview = forms.TreeGridView()
self.m_treegridview.Size = drawing.Size(200, 200)
column1 = forms.GridColumn()
column1.HeaderText = 'Tree'
column1.Editable = True
column1.DataCell = forms.TextBoxCell(0)
self.m_treegridview.Columns.Add(column1)

# Add more columns 
treecollection = forms.TreeGridItemCollection()
item1 = forms.TreeGridItem(Values=('coolnode1', 'coolnode2', 'coolnode3'))

# Add items and children
self.m_treegridview.DataStore = treecollection

Farouk

Hello,
I don’t see a match in Eto so for now I’m writing a component with GridView.
But with TreeGridView or GridView, you need to implement MoveUp, MoveDown, Append, Delete logic.
With orderlisbox or editlistbox, this logic and buttons were integrated, which was convenient.
jmv

Hi @kitjmv,

Try this:

import Rhino
import scriptcontext as sc
import System

__rhinoscript__ = '1c7a3523-9a8f-4cec-a8e0-310f580536a7'

def OrderListBox():
    rs = Rhino.RhinoApp.GetPlugInObject(__rhinoscript__) 
    if rs:
        list = System.Collections.Generic.List[System.String]()
        list.Add("Item0") 
        list.Add("Item1") 
        list.Add("Item2") 
        list.Add("Item3") 
        list.Add("Item4") 
        result = rs.OrderListbox(list.ToArray(), "Drag items to move", "Order Items")
        print(result)
        
OrderListBox()

– Dale

Thanks @dale !

It’s exactly that. It works fine on Rhino 7, but not with Rhino 8…

jmv

Seems to work here in V8 using RunPythonScript.

– Dale

exact! It works this way.

I tested your code with RhinoCode and got this:

jmv

Make sure to use IronPython.

#! python 2

import rhinoscriptsyntax as rs
import scriptcontext as sc

import System
import System.Collections.Generic
import Rhino

__rhinoscript__ = '1c7a3523-9a8f-4cec-a8e0-310f580536a7'

def OrderListBox():
    rs = Rhino.RhinoApp.GetPlugInObject(__rhinoscript__) 
    if rs:
        list = System.Collections.Generic.List[System.String]()
        list.Add("Item0") 
        list.Add("Item1") 
        list.Add("Item2") 
        list.Add("Item3") 
        list.Add("Item4") 
        result = rs.OrderListbox(list.ToArray(), "Drag items to move", "Order Items")
        print(result)
        
OrderListBox()

OK, I see,

PythonNet doesn’t let you get Windows objects but IronPython does.

merci Dale.