Clear Filters
Clear Filters

Figure createfcn in app designer

5 views (last 30 days)
Adee
Adee on 2 Dec 2021
Answered: Adee on 2 Dec 2021
I have an app that always creates an empty figure when I load it into appdesigner. It is quite annoying.
I realized after some debugging that it is caused by the createfcn property of the top figure, which has been set to a function that caused the window to open. When I deleted the function I got an error. The biggest problem is, I could not find any way to access the createfcn field from appdesigner.
The value of createfcn seems to have resulted from setting the default figure createfcn to a non-empty value when the app was created... After that point, it is saved in the app with no apparent way to change it.
To reproduce this problem, do something like
set(groot, 'defaultfigurecreatefcn', 'disp Hello')
and then create an app in appdesigner.
I suspect the same issue can happen with any of the default settings, especially createfcn's of various objects, that are not exposed in appdesigner.
I have an awkward workaround that I'll post as an answer, but any other suggestions are welcome.

Answers (1)

Adee
Adee on 2 Dec 2021
An awkward way to remove the figure createfcn:
  1. Place a breakpoint in %MATLABPATH%\toolbox\matlab\appdesigner\appdesigner\+appdesigner\+internal\+serialization\FileReader.m, after the line "appData = load(tempFileLocation);" (That is the line that causes the createfcn to run).
  2. Load the app into appdesigner
  3. When the breakpoint is hit, Enter appData.components.UIFigure.CreateFcn='' ;
  4. Continue with loading the app
  5. Use "Save as" to save the app with another name
The app with the new name should have no figure createfcn.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!