Hi all,
short version of my question:
How do I use MenuItemMorph>>#debugAction?
Now the long version. I was trying to use the debugger to understand how some "demo morphs" are created, starting by this one:
World -> new morph... -> from alphabetical list -> L-N -> LineMorph
I used the debug tool of the halo to copy the MenuItemMorph of that menu entry to a globally-acessible place, and then in a workspace I copied that to a variable local to that workspace called itemLineMorph. I was playing with that variable, and I did a "browse protocol" on it and I was reading its results. One of them, that looked especially interesting, was:
MenuItemMorph >> #debugAction
I tried this,
itemLineMorph debugAction.
and it opens the debugger - really neat! But if I tell the debugger to "proceed" it halts a few steps ahead, with this error:
UndefinedObject(Object)>>doesNotUnderstand: #hand TheWorldMenu>>newMorphOfClass:event: [] in MenuItemMorph>>invokeWithEvent: CursorWithMask(Cursor)>>showWhile: MenuItemMorph>>invokeWithEvent: MenuItemMorph>>doButtonAction [] in MenuItemMorph>>debugAction [] in FullBlockClosure(BlockClosure)>>newProcess
the problem is that in
TheWorldMenu>>newMorphOfClass:event:
the argument evt is nil... if I set evt by hand there to a keyboard event that holds a CR and then tell the debugger to proceed, everything works - I get a LineMorph on the screen.
So: what is the _right_ way to run MenuItemMorph>>#debugAction? And what is the right way to write something similar to this,
itemLineMorph debugAction.
but that works out of the box?
Thanks in advance! Eduardo Ochs http://anggtwu.net/eev-squeak.html
On Fri, Mar 3, 2023 at 6:19 PM Eduardo Ochs eduardoochs@gmail.com wrote:
Hi all,
short version of my question:
How do I use MenuItemMorph>>#debugAction?
If you browse the senders of this, you will see that certain morphs add this to their debug menu. One of them is MenuItemMorph.
*buildDebugMenu:* aHandMorph | aMenu | aMenu *:=* super buildDebugMenu: aHandMorph. aMenu addLine. aMenu add: 'browse action code' translated target: self action: #browseImplementationOfActionSelector. aMenu add: 'debug action invocation' translated target: self action: #debugAction. ^ aMenu
So basically you bring up the halo for a menu item (bring up halo for menu, then click again for halo of item), click the red halo handle to get the morph's menu:
[image: image.png]
At the bottom of its the debug submenu you will fine the debug action entry:
[image: image.png]
Vanessa
Hi Vanessa!
First: wow, thanks! I need to use the menu item of the halo more... will do that!
Second: I've tried the "debug action invocation" option in the halo menu for this menu item,
World -> new morph... -> from alphabetical list -> L-N -> LineMorph
and when I clicked "proceed" in the debugger I got exactly the same error as before, i.e., this,
UndefinedObject(Object)>>doesNotUnderstand: #hand TheWorldMenu>>newMorphOfClass:event: [] in MenuItemMorph>>invokeWithEvent: CursorWithMask(Cursor)>>showWhile: MenuItemMorph>>invokeWithEvent: MenuItemMorph>>doButtonAction [] in MenuItemMorph>>debugAction [] in FullBlockClosure(BlockClosure)>>newProcess
because the argument "evt" in TheWorldMenu>>newMorphOfClass:event: is nil... but if before clicking on "proceed" I change evt to a CR, then I don't get any errors, and the LineMorph is created.
Do you think that one of these two methods should be changed?
TheWorldMenu >> #newMorphOfClass:event: MenuItemMorph >> #debugAction
(I am just a newbie 😶)
Cheers, Eduardo
On Fri, 3 Mar 2023 at 23:52, Vanessa Freudenberg vanessa@codefrau.net wrote:
On Fri, Mar 3, 2023 at 6:19 PM Eduardo Ochs eduardoochs@gmail.com wrote:
Hi all,
short version of my question:
How do I use MenuItemMorph>>#debugAction?
If you browse the senders of this, you will see that certain morphs add this to their debug menu. One of them is MenuItemMorph.
*buildDebugMenu:* aHandMorph | aMenu | aMenu *:=* super buildDebugMenu: aHandMorph. aMenu addLine. aMenu add: 'browse action code' translated target: self action: #browseImplementationOfActionSelector. aMenu add: 'debug action invocation' translated target: self action: #debugAction. ^ aMenu
So basically you bring up the halo for a menu item (bring up halo for menu, then click again for halo of item), click the red halo handle to get the morph's menu:
[image: image.png]
At the bottom of its the debug submenu you will fine the debug action entry:
[image: image.png]
Vanessa
squeak-dev@lists.squeakfoundation.org