Info

This question is closed. Reopen it to edit or answer.

automatic headlining of uicontrol

1 view (last 30 days)
Vlad
Vlad on 5 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 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 Comments
David Barry
David Barry on 5 Mar 2015
Can you explain what you mean by headlining?
Vlad
Vlad on 6 Mar 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.

Answers (1)

Adam
Adam on 5 Mar 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 Comments
Adam
Adam on 6 Mar 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 on 6 Mar 2015
Thanx. I did like you said. Now it is at least resizable and looks more or less suitable for me =)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!