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

85 ビュー (過去 30 日間)
Frank van Diggelen
Frank van Diggelen 2017 年 8 月 3 日
編集済み: Frank van Diggelen 2022 年 6 月 17 日
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 日
  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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by