How to edit auto-generated code in App Designer?
88 ビュー (過去 30 日間)
古いコメントを表示
This question has been asked before, but not satisfactorily. Is there a way to edit the grayed-out text in the code view within App Designer? If not, this is a major drawback to using App Designer, which is otherwise incredibly useful.
3 件のコメント
Freya H
2018 年 8 月 14 日
Oh yeah I agree, that is a bit annoying. But I guess the general idea is to have the initial design setup in the design view and then have an action happen upon a certain event.
Some object properties,such as visibility, can be set right away though (in the component properties).
回答 (2 件)
Hyeonsu Nam
2021 年 9 月 3 日
May you can edit the gray colored area not by code itself, but by inspector browser
like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/728264/image.png)
1 件のコメント
Ramon Voncken
2024 年 4 月 2 日
This was very helpful for me, I was not aware of this option, thank you.
zapaiz
2019 年 7 月 3 日
編集済み: zapaiz
2019 年 7 月 3 日
I don't think it is possible BUT, there's a cleaner way to do what you want:
If you go to EDITOR > Callback and select UIFigure (the main graphic element) you can create and customize the startupFcn, the callback invoked at the startup of the app.
for example if you have DatePickers (SelectStart and SelectEnd) you can initialize them to today and 10 days ago respectively like this:
function startupFcn(app)
app.SelectStartDatePicker.set('Value', datetime('now') - days(10));
app.SelectEndDatePicker.set('Value',datetime('now'));
end
1 件のコメント
Robert Cadman
2022 年 10 月 21 日
Thank you! It slightly irritates me that you can't do this in the createComponents function but this will work.
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!