Borrar filtros
Borrar filtros

How to edit auto-generated code in App Designer?

88 visualizaciones (últimos 30 días)
Franklin Turbeville
Franklin Turbeville el 6 de Ag. de 2018
Comentada: Ramon Voncken el 2 de Abr. de 2024
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 comentarios
Franklin Turbeville
Franklin Turbeville el 13 de Ag. de 2018
Editada: Franklin Turbeville el 13 de Ag. de 2018
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 el 14 de Ag. de 2018
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).

Iniciar sesión para comentar.

Respuestas (2)

Hyeonsu Nam
Hyeonsu Nam el 3 de Sept. de 2021
May you can edit the gray colored area not by code itself, but by inspector browser
like this
  1 comentario
Ramon Voncken
Ramon Voncken el 2 de Abr. de 2024
This was very helpful for me, I was not aware of this option, thank you.

Iniciar sesión para comentar.


zapaiz
zapaiz el 3 de Jul. de 2019
Editada: zapaiz el 3 de Jul. de 2019
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 comentario
Robert Cadman
Robert Cadman el 21 de Oct. de 2022
Thank you! It slightly irritates me that you can't do this in the createComponents function but this will work.

Iniciar sesión para comentar.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by