Group Abstract Group Abstract

Message Boards Message Boards

1
|
9.7K Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Constructing palette that replaces selection with link to documentation

Posted 12 years ago

Hello,

I am hoping that someone with more experience than I can provide a quick example of how to create a simple palette. I know I should read the documentation to do this, but a simple working example is all I need.

I'd like to be able to select text from within a text cell, and then have a palette button replace the selection with a Hyperlink to the documentation.

For example, if the word HistogramList were selected, then that selection would be replaced with a ButtonBox:

ButtonBox["HistogramList", BaseStyle->"Link", ButtonData->"paclet:ref/HistogramList"]

and then I would install this as a palette for later use.

Thanks, WCC

POSTED BY: W. Craig Carter
4 Replies

I would like to additionally point out that if there is a Function name in a text or Section cell and one places the cursor in or just after it, or if it is selected, then the F1 key or the "Find selected Function" item in the Help menu will bring up the relevant Help page.

POSTED BY: W. Craig Carter

Try this Craig.

generateWRILink[] :=
 Module[{routineName, buttonText, button},
  routineName = NotebookRead[EvaluationNotebook[]];
  buttonText = "paclet:ref/" <> routineName;
  button = 
   ButtonBox[routineName, BaseStyle -> "Link", 
    ButtonData -> buttonText];
  NotebookWrite[EvaluationNotebook[], button]
  ]

Button["Make Link", generateWRILink[]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard