How to fill tree component nodes during app initialization?

조회 수: 10 (최근 30일)
Josh Drake
Josh Drake 2021년 4월 15일
답변: Marc Elpel 2021년 4월 15일
I'm writing an app in App Designer which contains a tree component. I would like to populate it with nodes assigned with the names of the contents of a specific folder and its sub folders. I would like to do this during app initailization, but I can't change the generated code to include a function call. What solutions are out there?

채택된 답변

Marc Elpel
Marc Elpel 2021년 4월 15일
You are correct that the creation code is locked in App Designer. The way around this is to create a Startup function, and put your code there.
Open the app in "Design View". In the Component Browser panel click on the top level of the app hierarchy. Below where it has options for Inspector & Callbacks, select Callbacks. Assign a Startup function there. You will be able to edit that code to instantiate the tree node items as needed.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by