[squeak-dev] Help with UiPushButton>>#on:send:to: in Morphic Designer
marcel.taeumel at hpi.de
Tue Jan 11 09:12:10 UTC 2022
Hi David --
Yes, as Tom explained, UiPushButton is part of the Widgets project , which builds upon the Signals project .
Use #connect:signal:toSelector: insteand of #on:send:to: See  for more information.
Am 11.01.2022 08:12:50 schrieb Tom Beckmann <tomjonabc at gmail.com>:
The widgets toolkit to which UiPushButton belongs uses a custom event mechanism called signals. You can find the place where #on:send:to is "disabled" here: https://github.com/hpi-swa/widgets/blob/master/repository/Widgets.package/UiButton.class/instance/initializeEventHandler.st [https://github.com/hpi-swa/widgets/blob/master/repository/Widgets.package/UiButton.class/instance/initializeEventHandler.st]
This is the package that UiPushButton uses to dispatch messages instead: https://github.com/hpi-swa/signals [https://github.com/hpi-swa/signals] I believe the signal you're looking for should be called #pressed then: https://github.com/hpi-swa/widgets/blob/master/repository/Widgets.package/UiButton.class/instance/pressed.st [https://github.com/hpi-swa/widgets/blob/master/repository/Widgets.package/UiButton.class/instance/pressed.st]
Maybe as a debugging strategy (that I haven't tried myself with this instance because I already the above suspicion), one way you *probably* could have found this out yourself would have been by overriding the mouseDown: method in UiPushButton, put a `self halt` at the top and have it call `super mouseDown:`. Admittedly, you would likely have wound up with quite a number of indirections (which may not be entirely clear unless you're deep in Morphic event lingo) until you would have eventually found that the events are being delegated to this Event Handler object that calls methods from the "signals" package.
How would you have known to override mouseDown:? Since UiPushButton is a Morph, it must still follow the Morphic event dispatching rules. Searching for "mouse" in the Morph methods should give you a couple that seem promising, and eventually you'd probably have hit the one that triggers a halt at the right moment :)
Not sure if this was actually helpful but I often find it quite interesting what sort of strategies people follow when debugging things, so I thought I'd give it a try :D
On Tue, Jan 11, 2022 at 4:52 AM David O'Toole <deeteeoh1138 at gmail.com [mailto:deeteeoh1138 at gmail.com]> wrote:
I cannot get UiPushButton>>#on:send:to: working; using on: #click it gives no error, but events are never sent. When I substitute an SBButton from Sandblocks, it works. Am I using the wrong selector with UiPushButton? Or perhaps I am missing something else? I would greatly appreciate any help you could offer in troubleshooting.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev