How to make a Text Area auto-scroll to bottom (created in app designer)

조회 수: 107 (최근 30일)
I created a Text Area in app designer. It is populated with status messages as the app runs. After a while the area fills with lines of text, and the vertical scroll bar appears, but new messages are written in the invisible part of the area. The user has to scroll down "by hand". How can I make the Text Area autoscroll, so that each new message is visible?

채택된 답변

Eric Sargent
Eric Sargent 2020년 12월 9일
As of R2020b uitextarea now supports scroll.
In this case you could use:
scroll(textArea, 'bottom')
  댓글 수: 1
Frank van Diggelen
Frank van Diggelen 2022년 6월 17일
편집: Frank van Diggelen 2022년 6월 17일
Thank you. This is working well for me from in an app built in appdesigner, in R2022a:
scroll(app.MyTextArea, 'bottom') %autoscroll text area to bottom

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chris Portal
Chris Portal 2017년 8월 5일
If it's possible to use a listbox instead of a text area, you would be able to use the scroll function to programmatically scroll specific items into view:
https://www.mathworks.com/help/matlab/ref/scroll.html
  댓글 수: 1
Marko Antila
Marko Antila 2019년 2월 14일
편집: Marko Antila 2019년 2월 14일
Scroll function does not work properly with App Designer List Box, unfortunately:
  • in startFcn it hides the List Box (permanently)
  • in callbacks it does exactly nothing

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by