User Tools

Site Tools


en:software:matlab:trepr:dev:gui:naming

Naming Conventions

“Convention over configuration” is sometimes a very good idea. Especially as it saves you lots of configuration and testing for special cases.

There is a few important aspects of naming conventions for the toolbox that matter:

  • Scheme of the tag name of every window
    • Important for generic closing of all subwindows if main GUI gets closed
  • Generic naming scheme of GUI functions

Tag names for GUI figures

Every GUI consists of one main figure, and this figure should have a unique tag that should start with the name of the main GUI window, followed by an underscore:

hMainFigure = figure('Tag','trEPRgui_infowindow',...
   ...
   );

At the same time, this tag should be identical with the function name.1) In this case, the above example would simplify to:

hMainFigure = figure('Tag',mfilename,...
   ...
   );

There are several advantages of this approach:

  • You can easily search for GUI windows belonging to one toolbox (using the findobj() function)
  • You can close all GUI windows with one command in one line.
  • You immediately know from within a function file what the corresponding tag is, making it possible to use mfilename for getting the figure tag.

Names for GUI functions

Every GUI function should start with the name of the main GUI of the toolbox, followed by an underscore, e.g.:

  • trEPRgui_infowindow()

Subwindows currently follow a slightly different scheme. Suppose you have a help window for the infowindow, then its name would be:

  • trEPRgui_info_helpwindow

Please note: Whereas the main GUI function, here trEPRgui_infowindow(), resides inside the GUI directory of the toolbox (for details see the directory layout of the toolbox), the respective help window (and every other subwindow of this GUI) should reside inside the private directory within the GUI directory.

1)
Please note: Currently, this is not true for all GUI windows of the toolbox, but this is the way it should be.
en/software/matlab/trepr/dev/gui/naming.txt · Last modified: 2020/09/30 21:35 by 127.0.0.1