Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

automatic headlining of uicontrol

1 visualización (últimos 30 días)
Vlad
Vlad el 5 de Mzo. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi everyone.
Is there any solution for automatic headlining of uicontrol('Style', 'edit')? Now I'm using two uicontrols: the first one is uicontrol('Style', 'edit') and the second one is uicontrol('Style', 'text') for headlining. Sometimes it is not very convenient. Any ideas?
  2 comentarios
David Barry
David Barry el 5 de Mzo. de 2015
Can you explain what you mean by headlining?
Vlad
Vlad el 6 de Mzo. de 2015
As Adam said (see below), I want to have explanation for what my edit box represents. But there is no special parameter for iucontrol.

Respuestas (1)

Adam
Adam el 5 de Mzo. de 2015
You can put an edit box in a panel which can have a title if you prefer. It isn't especially any neater, but it is an alternative.
That is, if I understand your question correctly that you wish to have some kind of title/explanation for what the edit box represents.
  3 comentarios
Adam
Adam el 6 de Mzo. de 2015
You need to use 'normalized' units to have resizeable components. There are some bugs in that area with regard to nesting them deeply within panels, but for simple cases you should be fine.
If you really want to define your initial editbox size in pixels rather than as a proportion of the size of the panel you can do what you did and then
set( hbsp, 'Units', 'normalized' );
or you can just add the 'Units' into the creation of the uicontrol after the position.
However, if you do want to define the editbox position in normalised units (e.g. [0.1 0.1 0.8 0.8] to say it will always be 80% of the panel size in both directions and always 10% in from the corner) then you must do it as:
hbsp = uicontrol(hsp,''Style', 'edit', 'String','Type here',...
'Units', 'normalized', 'Position',[0.1 0.1 0.8 0.8]);
i.e. Units defined before Position because your position vector is interpreted in whatever the units currently are, hence the ordering of Units and Position matters
Vlad
Vlad el 6 de Mzo. de 2015
Thanx. I did like you said. Now it is at least resizable and looks more or less suitable for me =)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by