Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Changing the behavior of pop-up tooltip context-sensitive usage in command window

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Mason Freed

Date: 14 Jan, 2011 00:42:06

Message: 1 of 7

Some (admittedly builtin) functions, such as surf, generate a very nice list of possible function usage strings in the yellow pop-up tooltip window, when you type "surf(" at the command prompt. However, for user-written functions, all you get is exactly what is on the function line of the function. Adding insult to injury, for methods on custom classes, if I type "myObj.myMethod(" for my class, it simply pops up "myMethod(MyObj object...)" and doesn't show ANY of the actual function arguments.

So... to the question. How do I overload the behavior of these tooltips?

Yair, this sounds like a good question for you...?

Thanks,
Mason

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Yair Altman

Date: 14 Jan, 2011 07:09:07

Message: 2 of 7

"Mason Freed" wrote in message <igo64u$oje$1@fred.mathworks.com>...
> Some (admittedly builtin) functions, such as surf, generate a very nice list of possible function usage strings in the yellow pop-up tooltip window, when you type "surf(" at the command prompt. However, for user-written functions, all you get is exactly what is on the function line of the function. Adding insult to injury, for methods on custom classes, if I type "myObj.myMethod(" for my class, it simply pops up "myMethod(MyObj object...)" and doesn't show ANY of the actual function arguments.
>
> So... to the question. How do I overload the behavior of these tooltips?
>
> Yair, this sounds like a good question for you...?
>
> Thanks,
> Mason

Naturally...
http://undocumentedmatlab.com/blog/setting-desktop-tab-completions/

Note that if your function accepts a varargin input arg, this parses as a '...' in the completions tooltip.

Yair Altman
http://UndocumentedMatlab.com

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Mason Freed

Date: 14 Jan, 2011 16:19:06

Message: 3 of 7

"Yair Altman" wrote in message <igosqj$9mt$1@fred.mathworks.com>...
>
> Naturally...
> http://undocumentedmatlab.com/blog/setting-desktop-tab-completions/
>
> Note that if your function accepts a varargin input arg, this parses as a '...' in the completions tooltip.
>
> Yair Altman
> http://UndocumentedMatlab.com

You're amazing. Thanks Yair.

(I guess only one complaint: when searching for the answer to this question, prior to posting, I didn't find that blog post. I searched google and your site's search directly. Guess I was using the wrong terms. You might want to include "tooltip", "context-sensitive", "pop-up", ... to that post?)

Mason

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Mason Freed

Date: 14 Jan, 2011 18:10:22

Message: 4 of 7

So... in working through this, I was going on your comment that you just need to put the usage into the "Syntax" section of the relevant html-help page for your function. I'm just trying to get the tooltip-popup to show the correct usage, I'm not so worried with the tab-completion list to be correct. See your comment here:

> "Yair Altman" wrote in message <igosqj$9mt$1@fred.mathworks.com>...
> @Henrik – I believe the syntax help is taken from the “Syntax” section of the relevant
> function’s doc page (the HTML webpage that is presented as a result of the doc
> function).
>
> If no doc page is defined, then the help-tooltip popup displays the arguments defined in
> your function’s declaration. In your example, testHelp is declared as having arguments
> “x” and “varargin”. “varargin” is always converted to “…”, so your tooltip will say:
> testHelp(x,…). If you wish to modify this, then specify meaningful argument names
> (which is always a good thing to do), and/or create a doc page.

The issue, I found, is that there isn't a way (as far as I can find) to build html help files for classes. Only directories full of functions. The "doc" output for a class or class member is auto-generated from the comment at the top of the class/method. So there's no way to generate the relevant Syntax section in the doc page. I tried adding a separate line called "Syntax" into the comments, and putting the correct usage there, but it didn't affect the tooltip text.

Do you know of any workaround for that? It seems like a stupid limitation that you can't generate html help for classes!

Thanks,
Mason

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Yair Altman

Date: 20 Jan, 2011 06:56:05

Message: 5 of 7

"Mason Freed" wrote in message <igq3ie$qf1$1@fred.mathworks.com>...
> The issue, I found, is that there isn't a way (as far as I can find) to build html help files for classes. Only directories full of functions. The "doc" output for a class or class member is auto-generated from the comment at the top of the class/method. So there's no way to generate the relevant Syntax section in the doc page. I tried adding a separate line called "Syntax" into the comments, and putting the correct usage there, but it didn't affect the tooltip text.


Try playing around with the text in your main help comment - I'm pretty sure that the SYNTAX section is auto-generated from there if you just find the expected syntax (no pun intended). When you find out, please post your findings here.

Yair Altman
http://UndocumentedMatlab.com

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Mason Freed

Date: 4 Feb, 2011 22:47:03

Message: 6 of 7

"Yair Altman" wrote in message <ih8ma5$sr2$1@fred.mathworks.com>...

> Try playing around with the text in your main help comment - I'm pretty sure that the SYNTAX section is auto-generated from there if you just find the expected syntax (no pun intended). When you find out, please post your findings here.


Despite my best effots ("syntax" by itself, "syntax:" by itself, new lines, no new lines, etc.), I was unable to get it to "recognize" the syntax section of my class help. I'm thinking it might not be possible!

Thanks,
Mason

Subject: Changing the behavior of pop-up tooltip context-sensitive usage in command window

From: Yair Altman

Date: 5 Feb, 2011 23:03:03

Message: 7 of 7

"Mason Freed" wrote in message <iihvl7$l2u$1@fred.mathworks.com>...
> "Yair Altman" wrote in message <ih8ma5$sr2$1@fred.mathworks.com>...
>
> > Try playing around with the text in your main help comment - I'm pretty sure that the SYNTAX section is auto-generated from there if you just find the expected syntax (no pun intended). When you find out, please post your findings here.
>
>
> Despite my best effots ("syntax" by itself, "syntax:" by itself, new lines, no new lines, etc.), I was unable to get it to "recognize" the syntax section of my class help. I'm thinking it might not be possible!
>
> Thanks,
> Mason


This limitation may be hard-coded in help2html.m and its internally-called private functions within the %matlabroot%/toolbox/matlab/helptools/+helpUtils/ folder (esp. helpParts.m). Because of this, help2html recognizes "See also", "Overloaded methods" and "Note" but none of the other section headers.

Pity.

Of course, you can always dig into the m-files code and fix them to suit your needs. Yummy...

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us