Custom UI Components are removed from re-opened app file

조회 수: 5 (최근 30일)
goc3
goc3 2023년 8월 1일
편집: Levi Blake 2023년 10월 30일
Custom UI Components that I have created work as expected in an app (.mlapp) file. However, after closing the app file, upon reopening it, a warning dialog appears indicating that "Some components in this file could not be loaded."
I have been working on three components (which cannot be posted). All of them work separately and together in the app file as expected. However, if I load any one of them, or all three, into the app file, close the app file, and reopen it, any and all Custom UI Components are removed from the re-opened file.
I tried creating a new .mlapp file into which the components were placed. The results were the same.
Any help on keeping the components in the app file would be appreciated.
I do not know if this is related, but, for what it is worth, I followed the instructions on this page to configure each component before placing it in an app file:
Step three states: "click Add to Path to add the component and generated resources folder to the MATLAB path."
The way I understand that phrase, it means there should be two paths for each component. However, clicking Add to Path only ever adds one, pointing to the folder containing the component. Each time I attempted to manually add the "resources" folder using pathtool, I receive the following error:
You cannot add class folders (ones that start with '@'), package folders (ones that start with '+'), folders named 'resources', or private folders to the MATLAB search path.
Another possibly related point is that any MATLAB Project also has a resources folder. Two of the three components I referred to are in Project folders. However, one is not—that component, like the other two, is always automatically removed from any .mlapp file.
  댓글 수: 3
sunkuru jagabandhu
sunkuru jagabandhu 2023년 8월 14일
There are several possibility of this issue
  • First thing is there should be an issue with the components or some runtime error which are not detected.
  • In case you have tables in the component and binded with the displaydata change event(callback) then also you will get this kind of issue.
  • May be one more possibility is use of special characters in any resource files
  • In myexprinence with the custom ui components, The update method should have very minimal functionality. if you want to have intensive operation then you should do it with valid entry or exit flags and conditions.
Levi Blake
Levi Blake 2023년 10월 30일
편집: Levi Blake 2023년 10월 30일
@dpb The page you links does not say that the resources file should be in the location as the .mlapp file. It states that the folder should be placed there, which is the default behavior when you configure the app.
I have this same issue despite the custom component's .mlapp file and resources folder already being in the folder selected for the seach path before I open Matlab

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

채택된 답변

goc3
goc3 2023년 8월 1일
I believe I figured out the problem. While creating another component, I configured it for use in apps at the beginning and repeatedly placed it in a test app after adding one or two lines at a time.
The culprit line was an assignment to comp.Parent.Color. Upon commenting out or removing that line, the problem stopped occurring. (I made that change in all the components.)
I find it odd that MATLAB never provided any indication that this was a problem until re-opening the app file. Even then, the error did not point to the specific line/problem. Nonetheless, I am glad that repeated trial and error discovered the solution.
  댓글 수: 1
dpb
dpb 2023년 8월 1일
A lot of the debugging stuff is more difficult to find with the app developer it seems.
Does seem like a peculiar way it became apparent; you might consider creating a miniature test demo that can create the problem and submit it as an enhancement request to TMW to see if they can find a way to diagnose the problem.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by