Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple tooltip input suggestions for Matlab function [closed]

I notice on built in Matlab functions there can be multiple lines of possible input configurations like this

enter image description here

as opposed to just

enter image description here

I have to assume they use something akin to inputParser with the use of varargin, but I have been unsuccessful in trying to replicate this functionality. I would like to have the ability to do this but I'm starting to get the feeling this is only something you can do with built in functions.

Somethings that I have thought of or tried are:

  1. Parsing of the help doc (unsuccessful)
  2. Information in a separate file
  3. Creating the same functions for multiple classes (unsuccessful)
  4. Creating a fully functioning inputParser (unsuccessful)

Has anyone been able to do this?

like image 466
horriblyUnpythonic Avatar asked Oct 16 '13 21:10

horriblyUnpythonic


1 Answers

I have built a similar tool in the past that works quite well. Unfortunately it's a proprietary in-house tool so I can't share the actual tool. However I can tell you that after investigating several options (similar to those you listed) we decided to use a special syntax for our help comments (similar to Markdown or restructuredText) that supports the declaration of syntax variants.

The information from the help texts is then parsed by the tool and can be displayed in different manners (e.g. by shadowing the original doc command with a custom one).

Regarding the actual pop-up menu you may try to dig into the internals of the command window. Yair Altman has documented many unofficial ways to enhance the MATLAB GUI on his wonderful blog. For example, here's a post that describes how to add tab-completion to custom commands.

like image 146
Florian Brucker Avatar answered Oct 28 '22 18:10

Florian Brucker