[squeak-dev] Re: HelpBrowser openOn:topic page:????
gettimothy at zoho.com
Mon May 16 23:41:01 UTC 2016
Thank you for your time and reply.
I understand what the openOn: method does.
Here is what I would like to do...
CustomHelp subclass: #CMakeVMMakerSqueakHelp
I have the class side method
^#(overview prerequisites namingConventions )
When I run
HelpBrowser openOn: CMakeVMMakerSqueakOverviewHelp
it opens the HelpBrowser just fine and the pages appear in the left hand panel.
What I would like to do is have it select the namingConventions page
HelpBrowser openOn: CMakeVMMakerSqueakOverviewHelp page: #namingConventions
If the functionality does not exist, so be it. I may try adding it at another time.
---- On Mon, 16 May 2016 14:16:46 -0400 marcel.taeumel <Marcel.Taeumel at hpi.de> wrote ----
this help system consists of help topics, which form a hierarchy. Each such
topic has text content. Given this, there is no distinction between "topic"
and "page". There are just topics.
As you have correctly found out, you can open any help topic via HelpBrowser
class >> #openOn:. This works with all arguments that understand
#asHelpTopic and are hence able to represent themselves in the right format.
You can browse implementors of #asHelpTopic for more details.
While you can open any help topic (in any tree of topics) with the help
browser, you are right, it might be helpful to open some "root topic" and
select some sub topic in it. I guess that's the "page" you are referring to.
Here is an example on how to do that:
(HelpBrowser openOn: HelpOnHelp) model
showTopicThat: [:topic | topic title beginsWith: 'API'].
This iterates the help structure until one topic returns "true". It's like
#detect:. It selects the result.
However, there can be a problem with writing such code because display
strings tend to be translated and changed. Therfore, help topics can have a
#key property to encode an id to refer to in that block. If there is no key,
you have to check for another property.
You might wonder, why this is so. Well, the creation of help topics is a
dynamic process. There is, for example, SWikiHelp, which fetches Web content
and parses sub-topics. So, we have to search for the topic to show, instead
of directly referring to it object-wise. If you get access to an instance of
HelpTopic, you can read it, but it might not be valid for a long time
because the Help Browser can update its caches.
View this message in context: http://forum.world.st/HelpBrowser-openOn-topic-page-tp4895008p4895185.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev