Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
automatic headlining of uicontrol
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Adam
am 5 Mär. 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 Kommentare
Adam
am 6 Mär. 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
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!