MATLAB Answers

taking control of tab completion w/ classdef

3 views (last 30 days)
Ben Mitch
Ben Mitch on 4 Dec 2011
hi
i am writing my custom classes using the classdef syntax, and sub-classing handle. the classes will be supplied to users, and i would like the tab completion to be as intuitive as possible for them since it's a great way for the class to self-document.
so, ideally, i would like to find a way to take complete control of what appears in the tab-completion list when an instance of my class is dot-indexed. as it stands, i have the following in place:
  • i implement "fieldnames()", which allows me to specify the data fields.
  • i use the attribute (Hidden) on all methods i do not want to appear in the list. this includes all superclass methods, but unfortunately isvalid() is Sealed, and i can't override it.
  • the list comprises the union of the data fields and the non-Hidden methods, as outlined above.
so, i can get the tab-completion list i want, with the exception of isvalid() which appears though i do not want it there. however, to do this i have to override all the superclass methods (e.g. eq, gt, le) with dummy implementations (or calls to the superclass), which seems like the long way round.
the question is - is there an easier way to manage tab completion? or a way to hide that isvalid() method? have i missed an obvious trick?
cheers ben

  0 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by