how to make set position and zise of a menu
e.g.:
choice = menu('Choose a color','Red','Blue','Green')
i want make this:
set('position',[ 100 100 100 100]) set('size', etc)
this commands are ivalids for function 'menu'
thanks adv

 Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Nov. de 2011

0 votos

The code for menu() determines the position and size automatically, taking in to account the size required in order to fit the text and the buttons.
The only thing you can change is
get(0,'DefaultUicontrolFontsize')
ans =
10
to provide a larger font size (which would result in the text being larger, thus affecting the window size.)
If you need finer control, then menu() is not the appropriate tool for the task. menu() is designed for simplicity of user interface.

5 comentarios

Artur M. G. Lourenço
Artur M. G. Lourenço el 4 de Nov. de 2011
otherwise you could indicate another function more accurate?
Walter Roberson
Walter Roberson el 4 de Nov. de 2011
You can use figure() and uicontrol() and make all the positioning and sizing adjustments you like. menu() only uses documented interfaces. You can read the source code,
type menu
to see how it works.
You may wish to consider using uicontrol('Style','list')
Walter Roberson
Walter Roberson el 4 de Nov. de 2011
To say explicitly: the various *dlg routines such as inputdlg() are also NOT designed for user control of the size or position; they are fairly similar to menu() in internal code design.
Alexei
Alexei el 24 de Oct. de 2014
Is it also impossible to put special characters into the menu choices? For instance I typed '1\omega' as one of the choices, and it just displayed 1\omega instead of what I wanted -- 1 followed by the Greek character. Or am I doing something wrong? This syntax works when inputting a label on a figure, for instance.
per isakson
per isakson el 24 de Oct. de 2014
Editada: per isakson el 24 de Oct. de 2014
See Customizing menu items part 1 and part 2 at Undocumented Matlab

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Nov. de 2011

Editada:

el 24 de Oct. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by