Python list box methods forget where they were


#1

I know I’ve mentioned this before, but most of the list box methods used with Python fail to open where they were last closed. Also re-sizing is not retained between usages. The exception is the PropertyListBox. It behaves like a Windows program should.

Here is a short video showing the issue. It’s frustrating.

http://screencast.com/t/Ics7DxPtNzHl

It makes no difference whether I cancel this list box or complete the command. The behaviour is the same.

Thanks,

Dan


Which rhinoscriptsyntax functions do you need to have implemented next?
RS: StringBox - control position on screen?
#2

Hi @DanBayn,

maybe you can use this ListBoxClass as a temporary replacement: ListBoxClass.py (4.4 KB)

I´ve tried to mimic Rhino.ListBox() as close as possible, you can use the same required and optional arguments. Note that getting the return value is slightly different. An example script to use this class is at the end of the script file.

The ListBoxClass saves dialog positions and sizes for every ListBox instance with a different title inside scriptcontext.sticky. So if you delete the sticky by resetting the script engine, or reopening Rhino this information is gone.

To make this less frustrating, you can set the default screen position (xy pixel coordinates) at line 96:

self.Location = System.Drawing.Point(100,200)

To avoid cluttering your code, you might just import the class at the beginning of your script. If the class is in the same folder with your script, use this line to import it:

from ListBoxClass import ListBox

Always make sure to import scriptcontext as well, before using this class !

c.


#3

Hi @clement,

I will take a look at this. Thanks.

I’m still requesting that this be fixed so that it mimics expected Windows behaviour. The PropertyListBox behaves correctly (as did the Rhinoscript listbox methods), so I don’t think it’s an unreasonable or impossible request.

Take care,

Dan


#4

Definitely - I have two monitors, Rhino most often on the secondary, and the listbox among other stuff - always shows up in the upper left corner of the primary, which is annoying. A lot of native Rhino panels show up there as well, Edge analysis, CurveGraph, etc…

–Mitch


(Giulio Piacentino) #5

Reported RH-41351 as discussed here: