<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Marcel,</p>
<p><br>
</p>
<p>I see your point in avoiding magic numbers to improve consistency. And I also agree with you that if the dynamically generated list can be expected to not fit into the screen, the application code should not use #chooseOptionFrom:.</p>
<p><br>
</p>
<p>Still, I think that automatic fallback code in the UI framework as a last resort would be a nice thing. For instance, when the user chooses an extremely small window size or a class has an unlikely high number of variables:</p>
<p><br>
</p>
<p><img size="0" contenttype="image/png" id="img897926" style="" contextid="img624079" tabindex="0" height="180" src="cid:bb621f39-8d81-4a45-8d0b-f789f5855846"><br>
</p>
<p><img size="15159" contenttype="image/png" id="img77114" style="" contextid="img974981" tabindex="0" height="431" src="cid:3e0a6014-edee-4479-8085-6a9157e9fa84"><br>
</p>
<p><br>
</p>
<p>What would be wrong with trying to improve the layouting before displaying something awkward? (Just like I also think it would be an improvement if #inform: dialogs automatically added a scrollbar when space is low - still, apps should not inform huge texts.)
 We can still make application code accountable for avoiding these situations based on domain knowledge. But the ExternalDropHandler should not need to check the screen size, for example.</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel<br>
<b>Gesendet:</b> Mittwoch, 4. Mai 2022 14:45:17<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] The Trunk: ToolBuilder-Morphic-tpr.312.mcz</font>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
...and your application code can actually check for that magic number if you really want to and then use either #chooseFrom: or #chooseOptionFrom:. No need to hide such a thing in the library.
<div><br>
</div>
<div>Best,</div>
<div>Marcel</div>
<div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">Am 04.05.2022 14:41:13 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi Christoph --
<div class="mb_sig"></div>
<div><br>
</div>
<div>Haha. ;-) 10 or 15 is not better than the original 7. Regardless of the direction. The application code has to choose between chooseFrom: and chooseOptionFrom:.</div>
<div><br>
</div>
<div>No magic number here anymore.</div>
<div><br>
</div>
<div>For your dynamically generated list, you should always use #chooseFrom:, not #chooseOptionFrom:. While you would still get an actual list for less than 10 items, it seems to be the better trade off and a more consistent user experience.</div>
<div><br>
</div>
<div>#chooseOptionFrom: is only for hard-coded lists of fixed options where you know what's happening and thus can design the appearance through buttons.</div>
<div><br>
</div>
<div>Best,</div>
<div>Marcel</div>
<blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 04.05.2022 14:29:48 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de>:</p>
<div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt;color: #000000;font-family: Calibri,Helvetica,sans-serif">
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">Very nice! May I suggest that we fall back to traditional #chooseFrom: if
 we have more than, </span><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">let's say, 10 or 15 options? In some scenarios, options
 might be generated dynamically, and in these cases, a scrollable list would still scale better. :-)</span><br>
</p>
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px"><br>
</span></p>
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">Best,</span></p>
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">Christoph</span></p>
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px"><br>
</span></p>
<p><span style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px"><img size="9948" id="x_img765921" tabindex="0" style="max-width:99.9%" src="cid:07c3b015-332d-4240-bfea-753a512a6b01"><!-- </img> --><br>
</span></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif;color: #000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Dienstag, 19. April 2022 20:59:20<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: ToolBuilder-Morphic-tpr.312.mcz</span>
<div> </div>
</div>
</div>
<span style="font-size: 10pt"><span style="font-size: 10pt">
<div class="PlainText">tim Rowledge uploaded a new version of ToolBuilder-Morphic to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/ToolBuilder-Morphic-tpr.312.mcz">http://source.squeak.org/trunk/ToolBuilder-Morphic-tpr.312.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: ToolBuilder-Morphic-tpr.312<br>
Author: tpr<br>
Time: 19 April 2022, 11:59:19.483381 am<br>
UUID: 3b32b25c-7cdf-4307-85af-84b0dfd08f1d<br>
Ancestors: ToolBuilder-Morphic-mt.311<br>
<br>
Add a ToolBuilder ability to show a list of options - typically a small number, maybe with a cancel button etc - as opposed to an arbitrary list of values. This separates it out from the chooseFrom:... protocol<br>
<br>
=============== Diff against ToolBuilder-Morphic-mt.311 ===============<br>
<br>
Item was changed:<br>
  ----- Method: MorphicUIManager>>chooseFrom:lines:title: (in category 'ui requests') -----<br>
  chooseFrom: aList lines: linesArray title: aString <br>
         "Choose an item from the given list. Answer the index of the selected item. Cancel value is 0.<br>
+        If you are choosing an option from a short list (see for example ZipArchiveMember>>#extractInDirectory:overwrite:) use MorphicUIManager>>#chooseOptionFrom:lines:title: instead."<br>
+        self<br>
+                askForProvidedAnswerTo: aString<br>
+                ifSupplied:<br>
+                        [:answer | <br>
+                        (answer = #cancel or: [answer isNil]) ifTrue: [^ 0].<br>
+                        ^ aList indexOf: answer].<br>
         <br>
-        There are several (historical) reasons for building a button dialog instead of a list chooser for small lists:<br>
-        1) Unfortunately, there is existing code that uses this call to create simple confirmation dialogs with a list of #(yes no cancel).<br>
-        2) Unfortunately, there is existing code that uses this call to mimick a drop-down menu with a (compact) pop-up menu."<br>
-        self askForProvidedAnswerTo: aString ifSupplied: [:answer | <br>
-                (answer = #cancel or: [answer isNil]) ifTrue: [^ 0].<br>
-                ^ aList indexOf: answer].<br>
-        <br>
         aList ifEmpty: [^ 0].<br>
-        aList size <= 7 ifTrue: [<br>
-                | dialog |<br>
-                dialog := DialogWindow new<br>
-                        title: ListChooser defaultTitle;<br>
-                        message: aString;<br>
-                        filterEnabled: true;<br>
-                        autoCancel: true; "Like a pop-up menu, click anywhere to dismiss."<br>
-                        yourself.<br>
-                aList withIndexDo: [:ea :index |<br>
-                        dialog createButton: ea value: index].<br>
-                dialog selectedButtonIndex: 1.<br>
-                ^ dialog getUserResponseAtHand ifNil: [0]].<br>
-        <br>
         ^ ListChooser chooseFrom: aList title: aString!<br>
<br>
Item was changed:<br>
  ----- Method: MorphicUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----<br>
  chooseFrom: labelList values: valueList lines: linesArray title: aString <br>
         "Choose an item from the given list. Answer the selected item."<br>
         <br>
         | index |<br>
+        self<br>
+                askForProvidedAnswerTo: aString<br>
+                ifSupplied:<br>
+                        [:answer | <br>
+                        (answer = #cancel or: [answer isNil]) ifTrue: [^ nil].<br>
+                        ^ valueList at: (labelList indexOf: answer) ifAbsent:<br>
+                                        [answer isNumber <br>
+                                                ifTrue: [valueList at: answer ifAbsent: [nil]]<br>
+                                                ifFalse: [nil]]].<br>
-        self askForProvidedAnswerTo: aString ifSupplied: [:answer | <br>
-                (answer = #cancel or: [answer isNil]) ifTrue: [^ nil].<br>
-                ^ valueList at: (labelList indexOf: answer) ifAbsent: [<br>
-                                answer isNumber <br>
-                                        ifTrue: [valueList at: answer ifAbsent: [nil]]<br>
-                                        ifFalse: [nil]]].<br>
         <br>
         index := self chooseFrom: labelList lines: linesArray title: aString.<br>
         ^ index = 0<br>
                 ifTrue: [ nil ]<br>
                 ifFalse: [ valueList at: index ]!<br>
<br>
Item was added:<br>
+ ----- Method: MorphicUIManager>>chooseOptionFrom:lines:title: (in category 'ui requests') -----<br>
+ chooseOptionFrom: aList lines: linesArray title: aString <br>
+        | dialog |<br>
+        "Choose an option from the given list. Answer the index of the selected item. Cancel value is 0.<br>
+        <br>
+        There are several (historical) reasons for needing a button dialog instead of a list chooser for small lists:<br>
+        1) Unfortunately, there is existing code that uses this call to create simple confirmation dialogs with a list of #(yes no cancel).<br>
+        2) Unfortunately, there is existing code that uses this call to mimic a drop-down menu with a (compact) pop-up menu.<br>
+        This method *only*  provides the short list UI"<br>
+        self<br>
+                askForProvidedAnswerTo: aString<br>
+                ifSupplied:<br>
+                        [:answer | <br>
+                        (answer = #cancel or: [answer isNil]) ifTrue: [^ 0].<br>
+                        ^ aList indexOf: answer].<br>
+        <br>
+        aList ifEmpty: [^ 0].<br>
+        dialog := DialogWindow new<br>
+                title: ListChooser defaultTitle;<br>
+                message: aString;<br>
+                filterEnabled: true;<br>
+                autoCancel: true; "Like a pop-up menu, click anywhere to dismiss."<br>
+                yourself.<br>
+        aList withIndexDo: <br>
+                [:ea :index |<br>
+                dialog createButton: ea value: index].<br>
+        dialog selectedButtonIndex: 1.<br>
+        ^ dialog getUserResponseAtHand ifNil: [0]!<br>
<br>
<br>
</div>
</span></span></div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>