<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Thank you for improving this! I already had a similar hack in my image for some time, but your solution is cleaner, of course.</p>
<p><br>
</p>
<p>When putting further efforts into this construction site, I would like to kindly ask you again to take a look at <span>System-ct.1149.<span> :-) </span>In particular, I think that only checking the selector but not the receiver of the context is a too weak
 criterion, I have already experienced a number of "wrong halts" when another method on the stack had the same selector.</span></p>
<p><span><br>
</span></p>
<p><span>> <span>I refrained from adding the debug/browse interface for button actions to Morph.</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>I don't really see the problem here, Morph includes a lot of functionalities that are only used by certain subclasses. Anyway, could this be worth a trait, TMorphWithAction, or something similar? On the other hand, one morph might support multiple
 actions, so a generic solution would have its advantages ...</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>Best,</span></span></p>
<p><span><span>Christoph</span></span></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">
<div class="x__rp_U4 x_ms-font-weight-regular x_ms-font-color-neutralDark x_rpHighlightAllClass x_rpHighlightBodyClass" id="x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><font size="2"><span id="LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><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> Mittwoch, 14. April 2021 11:19:46<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: Morphic-mt.1751.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Marcel Taeumel uploaded a new version of Morphic to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Morphic-mt.1751.mcz">http://source.squeak.org/trunk/Morphic-mt.1751.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Morphic-mt.1751<br>
Author: mt<br>
Time: 14 April 2021, 11:19:35.123489 am<br>
UUID: 8fa68c8f-44ca-4d4a-a9e7-f69619be782e<br>
Ancestors: Morphic-mt.1750<br>
<br>
Slightly improve browsing and debugging of so-called "button actions" by also supporting #perform:orSendTo:, which yields #effectiveActionTarget and #effectiveActionSelector.<br>
<br>
(Note that this design is still to be improved. I refrained from adding the debug/browse interface for button actions to Morph. A next step might be to take a look at all implementors of #doButtonAction. Maybe this will generate some ideas.)<br>
<br>
=============== Diff against Morphic-mt.1750 ===============<br>
<br>
Item was removed:<br>
- ----- Method: MenuItemMorph>>browseAllImplementorsOfRealSelector (in category 'browse') -----<br>
- browseAllImplementorsOfRealSelector<br>
-        SystemNavigation default browseAllImplementorsOf: self realSelector localTo: target class!<br>
<br>
Item was changed:<br>
  ----- Method: MenuItemMorph>>browseImplementationOfActionSelector (in category 'browse') -----<br>
  browseImplementationOfActionSelector<br>
  <br>
         | method |<br>
+        method := self effectiveActionTarget class lookupSelector: self effectiveActionSelector.<br>
-        method := target class lookupSelector: selector.<br>
         ToolSet browse: method methodClass selector: method selector.!<br>
<br>
Item was changed:<br>
  ----- Method: MenuItemMorph>>debugAction (in category 'browse') -----<br>
  debugAction<br>
  <br>
         (Process<br>
                 forBlock: [self doButtonAction]<br>
+                runUntil: [:context | context selector = self effectiveActionSelector])<br>
-                runUntil: [:context | context selector = self selector])<br>
                         debugWithTitle: ('Debug menu action "{1}" in model "{2}"' format: {self contents. self target printString}).!<br>
<br>
Item was added:<br>
+ ----- Method: MenuItemMorph>>effectiveActionSelector (in category 'browse') -----<br>
+ effectiveActionSelector<br>
+        <br>
+        ^ self selector = #perform:orSendTo:<br>
+                ifTrue: [self arguments first]<br>
+                ifFalse: [self selector]!<br>
<br>
Item was added:<br>
+ ----- Method: MenuItemMorph>>effectiveActionTarget (in category 'browse') -----<br>
+ effectiveActionTarget<br>
+ <br>
+        ^ (self selector = #perform:orSendTo:<br>
+                and: [(self target respondsTo: self effectiveActionSelector) not])<br>
+                        ifTrue: [self arguments second]<br>
+                        ifFalse: [self target]!<br>
<br>
Item was removed:<br>
- ----- Method: MenuItemMorph>>realSelector (in category 'browse') -----<br>
- realSelector<br>
-        selector == #perform:orSendTo: ifTrue: [^arguments first].<br>
-        ^selector!<br>
<br>
Item was changed:<br>
  ----- Method: Morph>>doButtonAction (in category 'button') -----<br>
  doButtonAction<br>
+        "If the receiver has a button-action defined, do it now. The default button action of any morph is, well, to do nothing.  Note that there are several ways -- too many ways -- for morphs to have button-like actions. It is intended for morph classes
 whose very nature is to be buttons -- this method provides glue so that arbitrary buttons on the UI can be 'fired' programmatically from user scripts."!<br>
-        "If the receiver has a button-action defined, do it now.  The default button action of any morph is, well, to do nothing.  Note that there are several ways -- too many ways -- for morphs to have button-like actions.  This one refers not to the #mouseUpCodeToRun
 feature, nor does it refer to the Player-scripting mechanism.  Instead it is intended for morph classes whose very nature is to be buttons -- this method provides glue so that arbitrary buttons on the UI can be 'fired' programatticaly from user scripts"!<br>
<br>
Item was changed:<br>
  ----- Method: PluggableButtonMorph>>browseImplementationOfActionSelector (in category 'debug menu') -----<br>
  browseImplementationOfActionSelector<br>
  <br>
         | method |<br>
+        self updateArguments.<br>
+        method := self effectiveActionTarget class lookupSelector: self effectiveActionSelector.<br>
-        method := model class lookupSelector: actionSelector.<br>
         ToolSet browse: method methodClass selector: method selector.!<br>
<br>
Item was changed:<br>
  ----- Method: PluggableButtonMorph>>debugAction (in category 'debug menu') -----<br>
  debugAction<br>
  <br>
+        self updateArguments.<br>
+ <br>
         (Process<br>
+                forBlock: [self doButtonAction]<br>
+                runUntil: [:context | context selector = self effectiveActionSelector])<br>
-                forBlock: [self performAction]<br>
-                runUntil: [:context | context selector = self actionSelector])<br>
                         debugWithTitle: ('Debug button action "{1}" in model "{2}"' format: {self label. self target printString}).!<br>
<br>
Item was added:<br>
+ ----- Method: PluggableButtonMorph>>doButtonAction (in category 'button') -----<br>
+ doButtonAction<br>
+ <br>
+        ^ self performAction!<br>
<br>
Item was added:<br>
+ ----- Method: PluggableButtonMorph>>effectiveActionSelector (in category 'debug menu') -----<br>
+ effectiveActionSelector<br>
+        <br>
+        ^ self actionSelector = #perform:orSendTo:<br>
+                ifTrue: [arguments first]<br>
+                ifFalse: [self actionSelector]!<br>
<br>
Item was added:<br>
+ ----- Method: PluggableButtonMorph>>effectiveActionTarget (in category 'debug menu') -----<br>
+ effectiveActionTarget<br>
+ <br>
+        ^ (self actionSelector = #perform:orSendTo:<br>
+                and: [(self target respondsTo: self effectiveActionSelector) not])<br>
+                        ifTrue: [arguments second]<br>
+                        ifFalse: [self target]!<br>
<br>
Item was changed:<br>
+ ----- Method: PluggableButtonMorph>>hResizing: (in category 'layout properties') -----<br>
- ----- Method: PluggableButtonMorph>>hResizing: (in category 'layout-properties') -----<br>
  hResizing: aSymbol<br>
         "We adapt our minimum extent according to our resize behavior."<br>
         <br>
         self hResizing == aSymbol ifTrue: [^ self].<br>
         super hResizing: aSymbol.<br>
         self updateMinimumExtent.!<br>
<br>
Item was changed:<br>
+ ----- Method: PluggableButtonMorph>>performAction (in category 'event handling') -----<br>
- ----- Method: PluggableButtonMorph>>performAction (in category 'accessing') -----<br>
  performAction<br>
         "Inform the model that this button has been pressed. Sent by the controller when this button is pressed. If the button's actionSelector takes any arguments, they are obtained dynamically by sending the argumentSelector to the argumentsProvider"<br>
  <br>
         askBeforeChanging ifTrue: [model okToChange ifFalse: [^ self]].<br>
         actionSelector ifNotNil:<br>
                 [actionSelector numArgs = 0<br>
                         ifTrue:<br>
                                 [model perform: actionSelector]<br>
                         ifFalse:<br>
+                                [self updateArguments.<br>
-                                [argumentsProvider ifNotNil:<br>
-                                        [arguments := argumentsProvider perform: argumentsSelector].<br>
                                         model perform: actionSelector withArguments: arguments]]!<br>
<br>
Item was added:<br>
+ ----- Method: PluggableButtonMorph>>updateArguments (in category 'updating') -----<br>
+ updateArguments<br>
+ <br>
+        argumentsProvider ifNil: [^ self].<br>
+        argumentsSelector ifNil: [^ self].<br>
+        arguments := argumentsProvider perform: argumentsSelector.!<br>
<br>
Item was changed:<br>
+ ----- Method: PluggableButtonMorph>>vResizing: (in category 'layout properties') -----<br>
- ----- Method: PluggableButtonMorph>>vResizing: (in category 'layout-properties') -----<br>
  vResizing: aSymbol<br>
         "We adapt our minimum extent according to our resize behavior."<br>
         <br>
         self vResizing == aSymbol ifTrue: [^ self].<br>
         super vResizing: aSymbol.<br>
         self updateMinimumExtent.!<br>
<br>
<br>
</div>
</span></font>
</body>
</html>