Pimp My Gui Part 3: Help Me Help Yourself
10 Feb 2009 Quan Quach 2 comments 2,150 views
Blinkdagger proudly presents Pimp My Gui, a series that will provide our readers with tips and tricks on how they can make their GUIs beautiful on both the inside and outside.
In the previous post, we talked about using a custom menu bar to retain functionality while clearing up space on a GUI. In this post, we’re going to discuss how to implement a “help” feature for your GUI. The help feature should be informative and simple so that any person can learn how to use the GUI quickly. The help feature should offer other useful information such as the version number, author, and other tidbits of information.
In the last post, we ended up with this GUI, but we never did anything for the “help” portion of the GUI:


Contents
How to use this GUI: Quick User Guide
A simple but effective way to implement a help screen is to create another standalone GUI. For example, I created a standalone GUI that consists of only a static text component. I populated the text field with some helpful information regarding the GUI and detailed a succinct user’s guide.

When the GUI is called by the user, the user will see the following:

Of course, you can add more tidbits and information depending on the actual GUI. You might also want to add a FAQ section here if you feel your GUI needs some extra explanation. If you can’t fit all the information into one screen, you can also utilize pushbuttons that will change the static text when the button is pressed.
About this GUI
I also created a stand alone GUI for the “About”. This part should inform the user about what version of MATLAB the GUI was designed on, date of creation, name of author, some contact information, and the version number of the GUI.

When the GUI is called by the user, the user will see the following:

Putting it all together
All we have to do now is to call the appropriate help GUI in the appropriate callback, pretty straightforward stuff. When the menu items for the help menu was created, MATLAB automatically created callbacks for each menu item.

the callback for the “How to use this GUI” menu item is:
function helpGUI_Callback(hObject, eventdata, handles) %this is the name of the help GUI that contains the help information helpGUI_description
the callback for the “About this GUI” menu item is
function aboutGui_Callback(hObject, eventdata, handles) %this command calls the GUI that has the "about" information aboutGUI_description
Addpath
I have found that the addpath command within MATLAB can really help you keep your files organized. If your GUI utilizes other m-files or images, it can be advantageous to store them in appropriate subdirectories.
you can store them in a separate directory and simply add the path of that directory. It can get a little crowded in the main directory of your GUI, so its usually a good idea to put all your sub functions and sub GUIs in a lower level folder.
For example, the following image shows how I originally had my m-files organized. The main GUI files are Tutor_Commuter_QQ_05.fig and Tutor_Commuter_QQ_05.m. The rest of the files are used in creating the help.

In the following image, you can see how I reorganized the files. All the files except the main files are placed in the subfunctions folder.

Now, all that has to done is to add the path of the subfunctions within the Opening Function of the main GUI.
%the addpath adds the subfunctions folder onto the MATLAB path. m-files %within this directory will be run as if it were in the same directory as the %main GUI itself %the fullfile command combines directory names and parts %pwd is the "present working directory", which in this case will be where %the main GUI is located addpath(fullfile(pwd,'subfunctions');
Next Time
It looks like we’ve revamped Zane’s GUI so that it’s obtained a shade of respectability. If you guys have any more ideas on what can be done, we’d love to hear about it. In the near future, we’ll open up the floor and ask for GUIs from our readers! Until next time . . .
2 Responses to “Pimp My Gui Part 3: Help Me Help Yourself”
Leave a Reply
Include MATLAB code in your comment by doing the following:
<pre lang="MATLAB">
%insert code here
</pre>


MATLAB includes several built-in dialog boxes that you can use, like MSGBOX and HELPDLG.
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/msgbox.html
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/helpdlg.html
You can see the list of other dialog boxes (like MSGBOX and HELPDLG) by typing “help uitools” without the quotes at the MATLAB prompt.
Is there a reason (such as you didn’t know they existed
that you didn’t use one of those dialog boxes for the help items in the GUI?
Thanks Steve!
You bring up a good point! Sometimes I just forget about the simple things and do them the hard way. For simple help instructions, I agree 100% that your suggestion is ideal.
But for more customization (such as larger font, color schemes, graphics, multi page text) creating a stand alone GUI can be advantageous.
Quan