GUI buttons with two rows
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Erik
am 25 Jul. 2011
Beantwortet: Runo Insan
am 14 Mär. 2020
Hey,
I'll keep it short and sweet. I'm making a GUI, which loads a bunch of data from variable sources and writes it on the different buttons, sliders and text squares in the GUI. I want some of that data to be shown in a button as two rows. This is the data:
Handling1 = {'Treudd (14)'; 'Ob4T6 + 3 (Stick)'};
and the loader:
set(handles.Handling11,'String',Handling1)
Now, I'm quite new at Matlab, and I'm hoping there's another way of doing this, because this method only gives me the first row ('Treudd (14)') and not the second. I've tried making it a normal matrix (not a string matrix), but that didn't work either.
Is there another method to make a button show two rows?
Thanks in advance! Erik
0 Kommentare
Akzeptierte Antwort
Oleg Komarov
am 25 Jul. 2011
h = uicontrol('style','push','position',[20 20 100 80],'max',10,...
'String', '<html>Treudd (14)<br>Ob4T6 + 3 (Stick)');
Weitere Antworten (2)
Paulo Silva
am 25 Jul. 2011
MATLAB buttons don't support multiline (I might be wrong). Instead of buttons consider using text or edit objects, they also have one callback that is called when you click on them.
0 Kommentare
Runo Insan
am 14 Mär. 2020
In Matlab GUI editor, double click on a push button, then properties will be opened, choose "String" row and click on in-middle button, then type these:
<html><center><b>
This is the first row
<br />
This is the second row
<br />
This is the first row
</b></center></html>
You can use HTML tags in Matlab GUI.
<center> tag lets you center the text in Matlab GUI
<b> tag lets you type in bold text in Matlab GUI
<br /> tag lets you spot the cursor to the next row down in Matlab GUI
<br> and <br /> can be used both with no errors as HTML tags. No need to close when you open <br> as <br/>, it works still without closing the tag; only for <br> tag, by the way.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!