<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Christoph,<div><br></div><div>while I cannot find an example for #doButtonAction (or #performAction) being the actual action to be called, I tried something with #value. </div><div><br></div><div><div><span style="font-size: 13.3333px">(PluggableButtonMorph</span></div><div><span style="font-size: 13.3333px"><span style="white-space:pre">      </span>on: [ Transcript showln: 'foo' ]</span></div><div><span style="font-size: 13.3333px"><span style="white-space:pre">      </span>getState: nil</span></div><div><span style="font-size: 13.3333px"><span style="white-space:pre"> </span>action: #value)</span></div><div><span style="font-size: 13.3333px"><span style="white-space:pre">       </span>label: 'foo';</span></div><div><span style="font-size: 13.3333px"><span style="white-space:pre"> </span>openInHand</span></div></div><div><br></div><div>There, I noticed an issue with blocks being the target since those will not show up as receiver on the stack. For blocks, "context closure" should be compared with the target, which is different from PluggableButtonMorphPlus, where "context closure" should be compared with the action.</div><div><br></div><div>Best,</div><div>Marcel</div><div><br></div><div>***</div><div><br></div><div><span style="font-size: 10pt">"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."<br>― Antoine de Saint-Exupéry</span><br></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;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 19.04.2021 19:53:24 schrieb Thiede, Christoph <christoph.thiede@student.hpi.uni-potsdam.de>:</p><div style="font-family:Arial,Helvetica,sans-serif">

<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>here are some example selectors:</p>
<p><br>
</p>
<p>#doButtonAction, #performAction, #value ...</p>
<p><br>
</p>
<p>While these all are non-recommended selector names, they can occur indeed (and a have indeed a project that forwards clicks from one button to another so the selector is #doButtonAction), and this is why I think that "debug button action" should be more
 robust against them. :-)</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="Signature">
<div id="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="divtagdefaultwrapper" style="font-family: Calibri,Arial,Helvetica,sans-serif;font-size: ;margin: 0">
<div><span style="font-size: 10pt;color: #808080"></span></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="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 Taeumel, Marcel<br>
<b>Gesendet:</b> Mittwoch, 14. April 2021 13:03:41<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> Re: [squeak-dev] The Trunk: Morphic-mt.1751.mcz</span>
<div> </div>
</div>
<div>
<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Hi Christoph,
<div><br>
</div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">> 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><br>
</div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px"><br>
</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">Can you give me 1 example? :-) Since we begin directly with calling the target ... how should anything interfere? Are you thinking about MethodWrappers?</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px"><br>
</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">Best,</span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif;font-size: 16px">Marcel</span></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;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 14.04.2021 12:25:22 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>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"><span style="font-family: 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"><span style="">
<div><span style="font-size: 12pt;color: black"><span style="font-size: 12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><span style="font-size: 10pt"><span id="LPlnk909538"><font color="#757B80"></font></span></span></a></span></span></div>
</span></div>
</div>
</span></div>
</div>
</div>
</div>
</div>
<div><span style="font-size: 10pt;color: #808080"></span></div>
</div>
</div>
</div>
</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> 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</span>
<div> </div>
</div>
</div>
<span style="font-size: 10pt"><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></span></div>
</blockquote>
</div>
</div>
</div></blockquote></div>