I am making a GUI app using Matlab's App Designer. I have a label that I dropped into the GUI that will be for instructions to the user. As they proceed, the instruction text lengths will vary. When the text length reaches the end of the label, it gives ...
and cuts off the message. I want the text to wrap inside the label.
I tried textwrap
, but it gave me an error stating that the parent cannot be a label.
To reproduce, create a new app on Matlab's App Designer, drag and drop a label onto the canvas, and type a long text into it. The label size will adjust to let it go off the app window. If you adjust the label width back, it will just cut off the text with ...
, like so:
Pressing Run
doesn't change it.
This is what I want to produce automatically when I change the text to be a string without new lines:
The code I am using to change the text is like this:
methods (Access = private)
% Callback function
function ButtonPushed(app, event)
app.Label.Text = "Lorem ipsum dolor sit amet consectetur adipiscing elit. Vivamus scelerisque nisi ac enim faucib porttitor velit varius. Phasellus luctus ullamcorper nul sit amet finibus neque vehicula ut. Nulla pellentesque.";
end
end
I'm hoping that I don't need to reinvent the wheel and design my own text wrapping function. Is there a method for doing this that has yet to be clarified in the documentation?