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
Hi Timothy,
On Jan 15, 2020, at 1:26 PM, tty wrote:
Hi All.
I want to dynamically build a drop-down menu in Seaside based on the instance side methods I have in a class.
Have you looked at the Seaside sample code for the WABrowser? On some Seaside images it will be registered at tools/classbrowser by default. I believe it uses a normal Browser as its model, so that's where to go to find out what's actually going on in the background.
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.
Any help much appreciated.
Have you looked at ClassOrganizer and ClassDescription?
best, a Tim
Hi Tim,
Thank you for the reply.
I was able to get the data by middle clicking on the Browser pane displaying the data and inspecting the model.
I then hand tweaked it, so my immediate task is solved.
I did look at a ClassOrganizer and ClassDescription but I keep getting nothing for what look like obvious candidates.
For example:
*WikitextParserFactory allMethodCategoriesIntegratedThrough:WikitextParserFactory
WikitextParserFactory whichCategoryIncludesSelector:#testTableCaption
*both return nada.
-- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
I just realized that I am trying to get Class side methods.
I have no Instance side methods.
Interesting!
I am going to change my WikitextParserFactory to a Singleton and move all the methods to Instanced side.
bet it will work then.
cheers!
-- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
Thanks to all for the pointers.
Here is what I came up with. To get all the categories, remove the "reject:" block
Transcript clear. (((WikitextParserFactory allMethodCategoriesIntegratedThrough:WikitextParserFactory) sorted) reject:[:r | |oc| oc := OrderedCollection with:#accessing with: #'initialize-release' with: #parsing with: #'Templates Bogus'. oc includes:r]) do:[:c |
(WikitextParserFactory packageInfo methodsInCategory: c ofClass:WikitextParserFactory) do:[:m | Transcript show: c , ' -> ', m methodSymbol; cr. ]].
cheers.
-- Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
beginners@lists.squeakfoundation.org