Re: Re: Adding hyperlinks to help browser files in function::usage

*To*: mathgroup at smc.vnet.net*Subject*: [mg47452] Re: [mg47428] Re: Adding hyperlinks to help browser files in function::usage*From*: John Fultz <jfultz at wolfram.com>*Date*: Tue, 13 Apr 2004 06:26:06 -0400 (EDT)*Reply-to*: jfultz at wolfram.com*Sender*: owner-wri-mathgroup at wolfram.com

As fascinating as the idea is that I work in a grand conspiracy covering up Knowledge Mankind Was Not Meant To Know (maybe working next door to Elvis), the actual reasons for information like this not being available is usually much more boring and involves priorities, resources, and deadlines. The More button is coded up in the DownValues for Information. But changing that code isn't a good idea since your code may break when moved to a different version of M--. I like the idea of writing a function which generates the messages in the style you already outlined below. MakeMyUsageMessage[symbol_, string_] := (symbol::usage = string <> " \!\(\*ButtonBox[\(More?\),ButtonStyle->\"AddOnsLink\",ButtonData:>\"" <> ToString[symbol] <> "\"]\)") MakeMyUsageMessage[HexGraph, "HexGraph[cols, rows] creates a hexagonal lattice having cols 'columns' and rows 'rows'. Setting the option EqualColumnHeights->False indicates that only odd numbered columns should have the specified number of rows."]; Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Sun, 11 Apr 2004 04:44:05 -0400 (EDT), Bobby R. Treat wrote: > Wolfram clearly doesn't want us to know such tricks, my friend. It's a > bit like that "tree of the knowledge of good and evil", maybe. > > Bobby > > "J. McKenzie Alexander" <jalex at lse.ac.uk> wrote in message > news:<c582lt$nos$1 at smc.vnet.net>... >> I have a question regarding the interaction between usage notes for >> user-defined functions and custom help documents written for inclusion >> in the Mathematica help browser. >> >> As you all know, the usage notes for a built-in function like Abs have >> the form >> >> "Abs[z] gives the absolute value of the real or complex number z. >> More..." >> >> where the "More..." is a hyperlink that, when clicked on, takes you to >> the appropriate help page. >> >> Looking at the actual definition of Abs::usage, though, reveals that >> the hyperlink isn't part of the usage notes. In >> /Applications/Mathematica >> 5.0.app/SystemFiles/Kernel/TextResources/English/Usage.m (I'm running >> OS X) it is defined as: >> >> Abs::usage = "Abs[z] gives the absolute value of the real or complex >> number z."; >> >> So the hyperlink is being added automatically some way. How? And what >> is the "proper" way to get this behaviour for the usage notes of >> functions I define in packages I write? >> >> After a lot of poking around, the only solution I've found (which is >> hardly elegant) is to do the following. Assuming that HexGraph.nb is >> installed under "Add-Ons & Links" in the help browser, define >> >> HexGraph::usage="HexGraph[cols, rows] creates a hexagonal lattice >> having cols 'columns' and rows 'rows'. Setting the option >> EqualColumnHeights->False indicates that only odd numbered columns >> should have the specified number of rows. >> \!\(\*ButtonBox[\(More?\),ButtonStyle->\"AddOnsLink\",ButtonData: >>> \"HexGraph\"]\)"; >> >> I suspect, though, given the definition of Abs::usage, that adding the >> hyperlink can be automated in some way when the help files are built or >> installed in the browser. >> >> Cheers, >> >> Jason