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

Marcel Taeumel marcel.taeumel at hpi.de
Mon Apr 18 10:00:03 UTC 2022

Hi Tim --

Yes, it would be nice to have an interface that will always give you a list (or row) of buttons.


Since you already did the work and updated all the existing code: go ahead and commit it. :-)

Extra points for also replacing "UIManager default" with "Project uiManager".

Am 18.04.2022 03:10:33 schrieb tim Rowledge <tim at rowledge.org>:
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.

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220418/75f87fc9/attachment.html>

More information about the Squeak-dev mailing list