Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to set popupmenu default values? in GUI

649 views
Skip to first unread message

Eizo2

unread,
Mar 10, 2011, 7:27:10 PM3/10/11
to
I want to set the popupmenu to start with some default value.

The problem is that although it does show some value in the GUI when
the GUI appear, this value is still not loaded in the code.
The user need to choose again this value in the menu in order for the
code to receive the event.

Question is, how you can set a default value, and also make the GUI
receive it as well, without the user intervention ?

Caliburn

unread,
Jul 1, 2011, 5:38:09 AM7/1/11
to
Eizo2 <odpr...@gmail.com> wrote in message <24d23160-6c05-498a...@k15g2000prk.googlegroups.com>...

To start the popupmenu with some default value in the opening function (e.g. function MyGUI_OpeningFcn) use the following code:

set(handles.MyMenu_popupmenu,'Value',2);

where MyMenu_popupmenu is the Tag of the popup menu you are setting starting default value.
Number 2 means the default value will be set to second item in the popup menu.
Let say you have four items in the popup menu: ms, s, min, h (four units for measuring time). The default value will be set to 's'.

0 new messages