Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

automatic headlining of uicontrol

조회 수: 1 (최근 30일)
Vlad
Vlad 2015년 3월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
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
David Barry
David Barry 2015년 3월 5일
Can you explain what you mean by headlining?
Vlad
Vlad 2015년 3월 6일
As Adam said (see below), I want to have explanation for what my edit box represents. But there is no special parameter for iucontrol.

답변 (1개)

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

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by