[squeak-dev] UIManager>>#chooseFrom: and related methods; sadly misused in many places

tim Rowledge tim at rowledge.org
Mon Apr 18 01:10:18 UTC 2022


Something that has annoyed me for years has finally trickled to the top of my attention; the way that we get different kinds of dialogues from the browser depending on how many variables are involved etc. This is a side-effect of the system only having one ToolBuilder compatible way of displaying a list to choose from but I claim we need (at least) two.

For lists where an indeterminate number of entries will be displayed - variable names belonging to the class, temps in a method, packages in the repository, stuff of that sort, we want a relatively heavyweight dialogue that can handle potentially large lists and gives us filtering and scrolling. For short (usually fixed) lists where the entries are things like 'delete this universe' & 'reboot simulation of QED' with perhaps a 'Cancel' we want a quite different dialogue more akin to a simple menu with a button or two. 

In order to handle this we currently have a rather dubious heuristic that makes the simple dialoge for less than 7 entries and the more complex one otherwise. When it comes to clicking on the browser 'variables' button this makes it a crapshoot as to which you get. This has irritated me so many times...

So, a possible solution is presented.

I have added #chooseOptionFrom:... (etc) which is intended for the choice between a short list of generally fixed options - see ChangeSet class>>#promptForDefaultChangeSetDirectoryIfNecessary for an example - and then removed the clause in MorphicUIManager>>#chooseOptionFrom:lines:title: that made the simple dialogue. Of course, we then have a number of methods that will trigger an unnecessarily heavy dialogue and so some users of the #chooseFrom... methods needed updating. I'm sure I must have missed at least one somewhere.

With the different kinds of dialogue requirement separated out we could, sometime, do a nicer job of handling the case where there is a simple choice between one or two or three options and maybe a cancel button.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChooseFrom-Dialogues.1.cs
Type: application/octet-stream
Size: 81482 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220417/21c8c19f/attachment-0001.obj>
-------------- next part --------------


tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: ESBD: Erase System and Burn Documentation




More information about the Squeak-dev mailing list