Rhinoscriptsyntax PopupMenu error


#1

There seems ot be something wrong with this method - using the following script to test:

import rhinoscriptsyntax as rs
def MyTest1():
    myList=["one","two","three","four","five"]
    choice=rs.PopupMenu(myList)
    print choice    
MyTest1()

this errors out with the message:

Message: Value cannot be null.  Parameter name: collection

In stepping into the method, it calls

Rhino.UI.Dialogs.ShowContextMenu(items, screen_point, modes)

This appears to be where the error is occurring, in the “modes” argument, it’s not liking “None”, it seems…
It’s expecting some sort of enumerable. If I run the following (with a mode specified):

import rhinoscriptsyntax as rs
def MyTest2():
    myList=["one","two","three","four","five"]
    choice=rs.PopupMenu(myList,modes=0)
    print choice
MyTest2()

I get a different error:

Message: expected IEnumerable[str], got list

Anyway, there’s something in there that needs to be fixed, either in the rhinoscript syntax or in RhinoCommon…

And I guess this is a moot point anyway I was trying to design something for the Mac, but I see that the PopupMenu method uses System.Windows.Forms.Cursor.Position, so it’s going to crash on a Mac anyway, I suppose…

–Mitch


(Steve Baer) #2

Yep, I see the bug and you are correct that this probably won’t work in it’s current form on OSX. I’ll get this fixed for Windows Rhino and will start figuring out what needs to be done to get these rhinoscriptsyntax “user interface” functions working on OSX.