Hi,
I'm trying to find out which code is run when I click on something in Squeak. I've tried selecting the menu from the middle button and then selecting debug -> explore morph. Is this the best way? Does it work for all morphs? How can I add new menu items which run arbitrary code? Thanks, Ian _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
El 6/26/07 5:47 PM, "Ian Oversby" <[hidden email]> escribió: > Hi, > > I'm trying to find out which code is run when I click on something > in Squeak. I've tried selecting the menu from the middle button > and then selecting debug -> explore morph. Is this the best > way? Does it work for all morphs? How can I add new menu > items which run arbitrary code? > > Thanks, > > Ian The best form is in the World menu, do item, select edit this list and add what you wish. And for taste of code, could select some and do debug it for follow with the over and into buttons of the debugger. For running code, you could select start/browse MessageTally . Use 3.10 and complain so we could improve the release !! Edgar _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Ian Oversby-2
On Tue, Jun 26, 2007 at 09:47:29PM +0100, Ian Oversby wrote:
> Hi, > > I'm trying to find out which code is run when I click on something > in Squeak. I've tried selecting the menu from the middle button > and then selecting debug -> explore morph. Is this the best > way? Does it work for all morphs? How can I add new menu > items which run arbitrary code? I tried exploring the morph, and also browsing the class protocol (select the object in the inspector/explorer, and press cmd-p). I limited the inheritance chain to StringMorph, and examined the "event handlers" method category. I looked at the mouseUp handler (mouse up is the usual place where actions are invoked), and the last line looked promising: "self invokeWithEvent: t1". I highlighted that and pressed cmd-m to jump to that method. The last few lines looked like the real work. So I put a "self halt." right above the Cursor normal showWhile: [...] block and saved (cmd-s). Now, whenever I hit a menu item, I get a debugger ready to execute the menu command. Whenever you are done, hit any menu item, remove the "self halt." in the debugger window, save, and proceed. Hope that helps. -- Matthew Fulmer -- http://mtfulmer.wordpress.com/ Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808 _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Edgar, Matthew and Jerome,
These all look like really helpful answers. Thanks very much. Ian _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Ian Oversby-2
Others gave the general approach and how to easily add code to menus.
I also tear apart menus, like you describe. Here's what I do: Explore morph and then look at target, selector, and arguments. Usually the selector is doMenuItem:with: and the arguments have the menu item and a symbol that becomes the message send. Check implementors of the symbol. Also, since most of the UI is "translated" you can find most of the messages that build the UI by looking at senders (alt+n) of translated. Ian Oversby wrote: > Hi, > > I'm trying to find out which code is run when I click on something > in Squeak. I've tried selecting the menu from the middle button > and then selecting debug -> explore morph. Is this the best > way? Does it work for all morphs? How can I add new menu > items which run arbitrary code? > > Thanks, > > Ian > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
What I usually do to find out is selecting a string (like, in an
error message, or shift-click the label of a button or menu item, or just typing it somewhere) and pressing Ctrl-E. This shows me all methods that use that string, and if it was sufficiently unique it's easy to spot which method was involved. From there, it's the usual senders/implementors image surfing to find out what happens next. - Bert - On Jun 28, 2007, at 4:14 , David Mitchell wrote: > Others gave the general approach and how to easily add code to menus. > > I also tear apart menus, like you describe. Here's what I do: > > Explore morph and then look at target, selector, and arguments. > Usually the selector is doMenuItem:with: and the arguments have the > menu item and a symbol that becomes the message send. Check > implementors of the symbol. > > Also, since most of the UI is "translated" you can find most of the > messages that build the UI by looking at senders (alt+n) of > translated. > > Ian Oversby wrote: > >> Hi, >> >> I'm trying to find out which code is run when I click on something >> in Squeak. I've tried selecting the menu from the middle button >> and then selecting debug -> explore morph. Is this the best >> way? Does it work for all morphs? How can I add new menu >> items which run arbitrary code? >> >> Thanks, >> >> Ian _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |