필터 지우기
필터 지우기

How to edit auto-generated code in App Designer?

조회 수: 88 (최근 30일)
Franklin Turbeville
Franklin Turbeville 2018년 8월 6일
댓글: Ramon Voncken 2024년 4월 2일
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
Franklin Turbeville
Franklin Turbeville 2018년 8월 13일
편집: Franklin Turbeville 2018년 8월 13일
I wanted the options in a listbox to be user generated. It would have been easy to write this where the listbox is created, but that code isn't editable. I used a startup function to accomplish the same task, but in general it would be nice to be able to edit the auto-generated code.
Freya H
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
Hyeonsu Nam 2021년 9월 3일
May you can edit the gray colored area not by code itself, but by inspector browser
like this
  댓글 수: 1
Ramon Voncken
Ramon Voncken 2024년 4월 2일
This was very helpful for me, I was not aware of this option, thank you.

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


zapaiz
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
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 CenterFile 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!

Translated by