Long string inside a static text which will pass on to another string when Push button is used
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Paragon
el 24 de Sept. de 2015
Comentada: Paragon
el 26 de Sept. de 2015
Hello Matlabers I am trying to find a way to turn my program into a GUI. The challenge I am faced with is that there is a lot of text in my program and I need to show these text in a static text. Also I want to assign a push button which will allow the user to pass on to the next sentence or paragraph (since the text is just too long to be seen at once and it reduces readability). I'm not that experienced.
0 comentarios
Respuesta aceptada
Walter Roberson
el 24 de Sept. de 2015
3 comentarios
Walter Roberson
el 24 de Sept. de 2015
The above link describes implicitly how you can have a push button change the scroll position of a multiline text box.
If your task is instead to have the pushbotton change the text box to show the next paragraph, then create a cell array of cell array of strings, and have a counter variable going (perhaps stored in the UserData of the box) and have the callback increment the counter, fetch the cell array of strings corresponding to the counter value, then set the String field to the text. For example,
paragraphs = {{'this is a short paragraph'};
{'this is paragraph 2 line 1', ...
'this is paragraph 2 line 2'}};
paranumber = get(handles.editbox1, 'UserData');
if isempty(paranumber); paranumber = 0; end
paranumber = min(paranumber+1, length(paragraphs));
set(handles.editbox1, 'UserData', paranumber);
this_paragraph = paragraphs{paranumber};
set(handles.editbox1, 'String', this_paragraph);
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!