Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the title states I would like to dynamically show ::usage on several functions.

Let's consider two functions here:


Thus I do:

   PopupMenu[Dynamic@whichfun, funlist], "usage should be here"], 

Instead of "usage should be here" I obviously tried (Dynamic@whichfun)::usage but it's complaining that the Head is not a Symbol, so I tried to convert it to a Symbol but it still fails.

Thus the question is:

How can I convert Dynamic@whichfun in order to be able to have its usage?

share|improve this question
up vote 3 down vote accepted

This is the problem with evaluation, since MessageName is HoldFirst. You can use e.g.

Dynamic[MessageName @@ {whichfun, "usage"}]


Dynamic @ MessageName[Evaluate[whichfun], "usage"]

in place of "usage should be here".

share|improve this answer
Thanks! It seems like I'll always do the same mistakes when I use Dynamic. Additional Question (might be to be edited): Do you know how to display the first line of the usage only? – Öskå Oct 1 '13 at 13:35
@Öskå Not sure how robust this is, but I would use something like this: Dynamic[First@ StringSplit[MessageName[Evaluate[whichfun], "usage"], "\n"]]. – Leonid Shifrin Oct 1 '13 at 14:02
It does the job, thanks! – Öskå Oct 1 '13 at 14:05

Use With to inject expression:

funlist = {Plot, Plot3D};
Input[Panel[PopupMenu[Dynamic@whichfun, funlist], 
  Dynamic[With[{t = whichfun}, MessageName[t, "usage"]]]], 

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.