[squeak-dev] Re: HelpBrowser openOn:topic page:????

marcel.taeumel Marcel.Taeumel at hpi.de
Mon May 16 18:16:46 UTC 2016


Hi Timothy,

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.

Best,
Marcel



--
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.


More information about the Squeak-dev mailing list