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:
Implementing a 'Help' GUI

Subject: Implementing a 'Help' GUI

From: Andy

Date: 27 Jul, 2009 19:13:03

Message: 1 of 8

Is there a simple way to implement a 'Help' section for a GUI? I can't seem to find things like scrollable panels, static text that works like a hyperlink (more accurately, static text that looks like a hyperlink), or (probably too much to hope for) a built-in search function. It's also hard to check Google or FEX for this, because the combination of terms 'help' and 'GUI' turn up a flood of GUIDE tutorials, simple GUI code, and the like. Is anybody aware of relevant code being posted on FEX or elsewhere? If not, does anybody have any suggestions for implementation?

Here are my thoughts so far. My GUI has fake tabbed panels controlled by a button group. There are several panels taking up exactly the same space, each linked to a button, so that a button press makes the relevant panel visible and all others invisible. This works fine for my four tabs in the GUI, but it seems like a poor solution for a 'Help' figure which might, even for a small program, have well over a dozen different topics. Also, I don't actually know that this would work fine with several panels. I did notice some unexpected behavior in my main GUI. Specifically, I had two panels that had axes in them, and even when one was not visible it seemed to interact with graphing on the other. In the end, I deleted one of them because it wasn't needed any more, so I never did figure out a reason for this behavior or a way to work around it.

As for the topic list part of the 'Help' figure, it seems like a listbox with BackgroundColor set to the default ui background color makes a decent topic list. Hierarchical structure of terms is not very good. Adding spaces to the beginning of strings to get indentations is a hassle and hard to maintain as the topic list changes, and I don't see a good way to collapse/expand sub-lists of topics in the hierarchy. Also, the terms do not look like they link to information (they can be turned blue with 'ForegroundColor', but I don't see a way to underline the text).

If anybody has any thoughts, please share them.

Subject: Implementing a 'Help' GUI

From: Donn Shull

Date: 28 Jul, 2009 00:12:01

Message: 2 of 8

"Andy " <theorigamist@gmail.com> wrote in message <h4ku7v$cnm$1@fred.mathworks.com>...
> Is there a simple way to implement a 'Help' section for a GUI? I can't seem to find things like scrollable panels, static text that works like a hyperlink (more accurately, static text that looks like a hyperlink), or (probably too much to hope for) a built-in search function. It's also hard to check Google or FEX for this, because the combination of terms 'help' and 'GUI' turn up a flood of GUIDE tutorials, simple GUI code, and the like. Is anybody aware of relevant code being posted on FEX or elsewhere? If not, does anybody have any suggestions for implementation?
>
> Here are my thoughts so far. My GUI has fake tabbed panels controlled by a button group. There are several panels taking up exactly the same space, each linked to a button, so that a button press makes the relevant panel visible and all others invisible. This works fine for my four tabs in the GUI, but it seems like a poor solution for a 'Help' figure which might, even for a small program, have well over a dozen different topics. Also, I don't actually know that this would work fine with several panels. I did notice some unexpected behavior in my main GUI. Specifically, I had two panels that had axes in them, and even when one was not visible it seemed to interact with graphing on the other. In the end, I deleted one of them because it wasn't needed any more, so I never did figure out a reason for this behavior or a way to work around it.
>
> As for the topic list part of the 'Help' figure, it seems like a listbox with BackgroundColor set to the default ui background color makes a decent topic list. Hierarchical structure of terms is not very good. Adding spaces to the beginning of strings to get indentations is a hassle and hard to maintain as the topic list changes, and I don't see a good way to collapse/expand sub-lists of topics in the hierarchy. Also, the terms do not look like they link to information (they can be turned blue with 'ForegroundColor', but I don't see a way to underline the text).
>
> If anybody has any thoughts, please share them.

Hi Andy,

This may not be of interest to you, but if you are adding help that is going to be used only in MATLAB you can make use of the help browser that is included with MATLAB. There is a section about adding your own help, and demos to The MATLAB start button. The help can then be accessed with the "doc('myhelpsection')" from any MATLAB function or GUI.

Just a thought,

Donn

Subject: Implementing a 'Help' GUI

From: Andy

Date: 28 Jul, 2009 13:19:02

Message: 3 of 8

"Donn Shull" <donn.shull.no_spam@aetoolbox.com> wrote in message <h4lfoh$ne4$1@fred.mathworks.com>...
> "Andy " <theorigamist@gmail.com> wrote in message <h4ku7v$cnm$1@fred.mathworks.com>...
> > Is there a simple way to implement a 'Help' section for a GUI? I can't seem to find things like scrollable panels, static text that works like a hyperlink (more accurately, static text that looks like a hyperlink), or (probably too much to hope for) a built-in search function. It's also hard to check Google or FEX for this, because the combination of terms 'help' and 'GUI' turn up a flood of GUIDE tutorials, simple GUI code, and the like. Is anybody aware of relevant code being posted on FEX or elsewhere? If not, does anybody have any suggestions for implementation?
> >
> > Here are my thoughts so far. My GUI has fake tabbed panels controlled by a button group. There are several panels taking up exactly the same space, each linked to a button, so that a button press makes the relevant panel visible and all others invisible. This works fine for my four tabs in the GUI, but it seems like a poor solution for a 'Help' figure which might, even for a small program, have well over a dozen different topics. Also, I don't actually know that this would work fine with several panels. I did notice some unexpected behavior in my main GUI. Specifically, I had two panels that had axes in them, and even when one was not visible it seemed to interact with graphing on the other. In the end, I deleted one of them because it wasn't needed any more, so I never did figure out a reason for this behavior or a way to work around it.
> >
> > As for the topic list part of the 'Help' figure, it seems like a listbox with BackgroundColor set to the default ui background color makes a decent topic list. Hierarchical structure of terms is not very good. Adding spaces to the beginning of strings to get indentations is a hassle and hard to maintain as the topic list changes, and I don't see a good way to collapse/expand sub-lists of topics in the hierarchy. Also, the terms do not look like they link to information (they can be turned blue with 'ForegroundColor', but I don't see a way to underline the text).
> >
> > If anybody has any thoughts, please share them.
>
> Hi Andy,
>
> This may not be of interest to you, but if you are adding help that is going to be used only in MATLAB you can make use of the help browser that is included with MATLAB. There is a section about adding your own help, and demos to The MATLAB start button. The help can then be accessed with the "doc('myhelpsection')" from any MATLAB function or GUI.
>
> Just a thought,
>
> Donn

Thanks for the suggestion. Unfortunately, the program I'm writing will eventually be made into a stand alone application for use on computers without MATLAB.

Any other ideas? On a related note, does anybody know how to make different elements in a list box different colors (or if it's possible)? I'm using a list box for my topic list, and I want some of the lines to be headers (so clicking on them should do nothing). As would be the case in a typical 'Help' section, I want the things that link to data to be blue and the things that don't to be black. But it doesn't seem like I can choose the ForegroundColor by line.

Subject: Implementing a 'Help' GUI

From: Matt Fig

Date: 28 Jul, 2009 15:45:20

Message: 4 of 8

"Andy " <theorigamist@gmail.com> wrote in message
> Any other ideas? On a related note, does anybody know how to make different elements in a list box different colors (or if it's possible)?



See #11:

http://www.mathworks.com/matlabcentral/fileexchange/24861

Subject: Implementing a 'Help' GUI

From: Donn Shull

Date: 28 Jul, 2009 15:52:02

Message: 5 of 8

"Andy " <theorigamist@gmail.com> wrote in message <h4mts6$4sf$1@fred.mathworks.com>...
> "Donn Shull" <donn.shull.no_spam@aetoolbox.com> wrote in message <h4lfoh$ne4$1@fred.mathworks.com>...
> > "Andy " <theorigamist@gmail.com> wrote in message <h4ku7v$cnm$1@fred.mathworks.com>...
> > > Is there a simple way to implement a 'Help' section for a GUI? I can't seem to find things like scrollable panels, static text that works like a hyperlink (more accurately, static text that looks like a hyperlink), or (probably too much to hope for) a built-in search function. It's also hard to check Google or FEX for this, because the combination of terms 'help' and 'GUI' turn up a flood of GUIDE tutorials, simple GUI code, and the like. Is anybody aware of relevant code being posted on FEX or elsewhere? If not, does anybody have any suggestions for implementation?
> > >
> > > Here are my thoughts so far. My GUI has fake tabbed panels controlled by a button group. There are several panels taking up exactly the same space, each linked to a button, so that a button press makes the relevant panel visible and all others invisible. This works fine for my four tabs in the GUI, but it seems like a poor solution for a 'Help' figure which might, even for a small program, have well over a dozen different topics. Also, I don't actually know that this would work fine with several panels. I did notice some unexpected behavior in my main GUI. Specifically, I had two panels that had axes in them, and even when one was not visible it seemed to interact with graphing on the other. In the end, I deleted one of them because it wasn't needed any more, so I never did figure out a reason for this behavior or a way to work around it.
> > >
> > > As for the topic list part of the 'Help' figure, it seems like a listbox with BackgroundColor set to the default ui background color makes a decent topic list. Hierarchical structure of terms is not very good. Adding spaces to the beginning of strings to get indentations is a hassle and hard to maintain as the topic list changes, and I don't see a good way to collapse/expand sub-lists of topics in the hierarchy. Also, the terms do not look like they link to information (they can be turned blue with 'ForegroundColor', but I don't see a way to underline the text).
> > >
> > > If anybody has any thoughts, please share them.
> >
> > Hi Andy,
> >
> > This may not be of interest to you, but if you are adding help that is going to be used only in MATLAB you can make use of the help browser that is included with MATLAB. There is a section about adding your own help, and demos to The MATLAB start button. The help can then be accessed with the "doc('myhelpsection')" from any MATLAB function or GUI.
> >
> > Just a thought,
> >
> > Donn
>
> Thanks for the suggestion. Unfortunately, the program I'm writing will eventually be made into a stand alone application for use on computers without MATLAB.
>
> Any other ideas? On a related note, does anybody know how to make different elements in a list box different colors (or if it's possible)? I'm using a list box for my topic list, and I want some of the lines to be headers (so clicking on them should do nothing). As would be the case in a typical 'Help' section, I want the things that link to data to be blue and the things that don't to be black. But it doesn't seem like I can choose the ForegroundColor by line.

Hi Andy,

You may want to look at Yair Altmans website http://undocumentedmatlab.com he has a lot of information there about GUI formatting using html tags to change fonts and colors in MATLAB.

Hope this helps,

Donn

Subject: Implementing a 'Help' GUI

From: Yair Altman

Date: 28 Jul, 2009 23:23:02

Message: 6 of 8

> Here are my thoughts so far. My GUI has fake tabbed panels controlled by a button group. There are several panels taking up exactly the same space, each linked to a button, so that a button press makes the relevant panel visible and all others invisible.

You can use the built-in uitab and uitabgroup for this. The benefit is that they look like standard system tabs, a look-and-feel that is difficult to achieve with regular buttons.

> As for the topic list part of the 'Help' figure, it seems like a listbox with BackgroundColor set to the default ui background color makes a decent topic list. Hierarchical structure of terms is not very good. Adding spaces to the beginning of strings to get indentations is a hassle and hard to maintain as the topic list changes, and I don't see a good way to collapse/expand sub-lists of topics in the hierarchy. Also, the terms do not look like they link to information (they can be turned blue with 'ForegroundColor', but I don't see a way to underline the text).

Try to use the built-in uitree and uitreenode functions. They allow collapsing/expanding nodes as well as customizing node fonts. See my FindJObj submission on the File Exchange for an example: http://www.mathworks.com/matlabcentral/fileexchange/14317

Note that these 4 functions are undocumented and unsupported officially. They work and will compile into a stand-alone application, but may change interface in some upcoming Matlab release.

Yair Altman
http://UndocumentedMatlab.com

Subject: Implementing a 'Help' GUI

From: Andy

Date: 29 Jul, 2009 14:12:03

Message: 7 of 8

@Matt Fig: These sample GUIs show a lot of useful things. I'm not currently on a computer with MATLAB, but I imagine that other HTML will also work within the 'String' property? For example:

    STR = {'<HTML><FONT COLOR="blue"><U>Link</U></BODY></HTML>'...

to simulate a link? (It would be especially neat if I could use something like <a href="mycallback">Link</a> to directly call the right callback for each link, but that's probably too much to hope for.)

@Donn Shull and Yair Altman: That website is great. I was aware of it, but I hadn't really read much of it until now (mainly because I don't think I can use undocumented or unsupported elements of MATLAB for work purposes; I will certainly look around the site for my own purposes).

Thanks to everyone for your help.

Subject: Implementing a 'Help' GUI

From: Yair Altman

Date: 5 Aug, 2009 18:29:03

Message: 8 of 8

> Is there a simple way to implement a 'Help' section for a GUI? [snip]


There are numerous ways in which a system-wide help system can be implemented. I just published a post about Matlab's internal support for such a system, which is one of the lesser-known semi-documented Matlab features: http://undocumentedmatlab.com/blog/context-sensitive-help/ .

But note again - this is just one of many alternatives for solving this issue.

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