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:
Quick uicontrol question (popupmenu)

Subject: Quick uicontrol question (popupmenu)

From: Chris

Date: 1 Oct, 2010 11:31:48

Message: 1 of 7

Hey, a quick question; what is the command to show the popupmenu's selection list? uicontrol(handle) doesn't work and I can't see a solution in the documentation, thanks!.

Subject: Quick uicontrol question (popupmenu)

From: Walter Roberson

Date: 1 Oct, 2010 14:39:11

Message: 2 of 7

On 01/10/10 6:31 AM, Chris wrote:
> Hey, a quick question; what is the command to show the popupmenu's selection list? uicontrol(handle) doesn't work and I can't see a solution in the documentation, thanks!.

get(handle, 'String')

Subject: Quick uicontrol question (popupmenu)

From: Chris

Date: 2 Oct, 2010 00:10:30

Message: 3 of 7

Thanks for the reply, I think my question wasn't worded quite right. When you have a uicontrol popupmenu in the gui you can click the right arrow and a popup menu with all the strings appear. I'm trying to get this functionality from the command line, rather than the GUI itself.

Subject: Quick uicontrol question (popupmenu)

From: Matt Fig

Date: 2 Oct, 2010 01:08:04

Message: 4 of 7

I think you will have to go to the JAVA for this. See Yair Altman's file exchange contribution, called FINDJOBJ. Once you have access to the underlying JAVA object, you should be able to do what you want. Note that I haven't tried this, but this is how I think it will have to go.

Subject: Quick uicontrol question (popupmenu)

From: Chris

Date: 2 Oct, 2010 02:18:49

Message: 5 of 7

Thanks

Subject: Quick uicontrol question (popupmenu)

From: Walter Roberson

Date: 2 Oct, 2010 02:41:22

Message: 6 of 7

On 01/10/10 7:10 PM, Chris wrote:
> Thanks for the reply, I think my question wasn't worded quite right. When you have a uicontrol popupmenu in the gui you can click the right arrow and a popup menu with all the strings appear. I'm trying to get this functionality from the command line, rather than the GUI itself.

Java Robot class ?

Subject: Quick uicontrol question (popupmenu)

From: Yair Altman

Date: 2 Oct, 2010 18:49:03

Message: 7 of 7

Chris <skynet414@gmail.com> wrote in message <603919594.30362.1285932738768.JavaMail.root@gallium.mathforum.org>...
> Hey, a quick question; what is the command to show the popupmenu's selection list? uicontrol(handle) doesn't work and I can't see a solution in the documentation, thanks!.

There is no documented way to do this, but you can use one of the following undocumented ways, mentioned by Matt and Walter:

1. Using FindJObj -
a) Download the FINDJOBJ utility from the Matlab File Exchange - http://www.mathworks.com/matlabcentral/fileexchange/14317-findjobj-find-java-handles-of-matlab-graphic-objects
b) Unzip FindJObj in your favorite Matlab path
c) Use FindJObj as follows:
hPopup=uicontrol('style','popup','string',{'a','b','c'}); % create popupmenu
jPopup = findjobj(hPopup);
jPopup.showPopup; % so simple!

You can use the UIInspect utility to check all the properties and methods that jPopup supports - http://www.mathworks.com/matlabcentral/fileexchange/17935-uiinspect-display-methods-properties-callbacks-of-an-object

2. Using Robot - see explanation here: http://undocumentedmatlab.com/blog/gui-automation-robot/

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