[Newbies] code to retrieve all method categories and methods under a category

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Jan 19 12:13:04 UTC 2020


[resent due to attachment limit, sorry for the delay!]


Hi Timothy,


not sure if your question has already been answered, but maybe this approach can help you in general to find answers to problems like these. Let's dive into some reverse engineering tools of Squeak!


First, start a normal System Browser and open the halo on the message category list:

[cid:e247e584-4759-42ff-a8f0-f53590827037]
Then open its debug menu by clicking the wrench icon and choose "browse action code":
[cid:b3e7c197-afce-47e1-8b0c-1ca915e3b728]
And you get the method which the list is configured to call in order to get its contents:
[cid:e0c18a28-1a14-46b2-8778-a7cd280bba87] [cid:6f42ff60-fbd8-4368-93a1-98e507f1ec6f]
By selecting #rawMessageCategoryList and pressing <cmd>m, you also get the second screenshot where you can see that your desired method is named #categories. Select #classOrMetaClassOrganizer and press <cmd>m again to find out where the organizer comes from:
[cid:a8efb7da-3286-4c44-a2be-35891b6aec32]
Okay, this is stored as an instance variable, but how is it set? Right-click the message from the list and choose "assignments..." (you can also do this in any class browser, btw). Next, select classOrganizer from the list.
[cid:92bd22b3-618e-4214-beed-378328dbadc1]
And you will find:
[cid:37b7bac7-e643-4145-ba08-f25172e74920]

So your script might look like this: MyClass organization categories.

I hope this might help you to answer future questions! And please forgive me if I told you something you already knew :-)
Have a nice time with Squeak!

Best,
Christoph

________________________________
Von: Beginners <beginners-bounces at lists.squeakfoundation.org> im Auftrag von tty <gettimothy at zoho.com>
Gesendet: Mittwoch, 15. Januar 2020 20:26 Uhr
An: beginners at lists.squeakfoundation.org
Betreff: [Newbies] code to retrieve all method categories and methods under a category

Hi All.

I want to dynamically build a drop-down menu in Seaside based on the
instance side methods I have in a class.

#MyClass has method categories: "Attributes Links Paragraph....etc"
Under Method category Links are  methods #testLinkCategory,
testLinkExternal, testLink....etc.

I have been hunting for over an hour and I see no obvious way to retrieve
this info (I have found a way to get all the methods, but not the category
that houses them.


The code I have in mind has form:

*categories := categoriesFor: #MyClass.

categories do:[:cat | |methods|
             methods :=  methodForClass:#MyClass category: cat.
             methods do:[:m |
                             "dynamically build my html here"
]]l*


Any help much appreciated.

thx



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
Smalltalk - Squeak - Beginners | Mailing List Archive<http://forum.world.st/Squeak-Beginners-f107673.html>
forum.world.st
Squeak - Beginners forum and mailing list archive. This list is the place to ask all the "simple" questions you as a newcomer to squeak always wanted to ask.



_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 203950 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 65978 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 110590 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 85930 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 99460 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 77865 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 115825 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200119/20321863/attachment-0013.png>


More information about the Beginners mailing list