-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error using mlapptools.getWebElements #25
Comments
Regarding the first issue, as the error says - more time needs to pass between the creation of the UIFigure and running
Regarding the 2nd issue - when exactly does it happen? When you run the code, or after you close a |
Thank you for your answer @Dev-iL . To answer your remarks :
I tested what you say but the issue n°2 is now showing 100% of the time...
It happens just after starting the interface (3 -4 seconds of delay). Actually, the I give you my code (I would prefer in private) but you will have many parts missing... Thanks |
@thiblab Please try to create a new App with just the minimum code required to reproduce the issue, then post the code of the App here. Did you try saving the code of the App in a regular |
The issue 2 seems indeed appear only with App Designer. So in which conditions I have to use mlappTools ? When using the code of App Designer but not using App Designer itself ? |
Yes, I would say that this is a sound course of action (at least that's how I always use it, because I used to have various problem running App Designer, so I ended up creating UIFigures completely programmatically)... You see, the App Designer itself is a uifigure (and hence, a "browser window"), so there must be some issues when we try making MATLAB have two browser windows communicating with each other. |
Sorry, I replied too fast. Below is a simple code that I am running as The behavior is actually strange : Sometimes it works, and when it works both
|
I can reproduce your problem. If your use-case permits it, I suggest you only take the code that creates components (and callbacks if there are any), then apply your customizations at the end. %% Create UIFigure and add components:
app = struct(); % < This is just to keep the same structure for the rest of the code.
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [100 82 325 280];
% Create Tab
app.Tab = uitab(app.TabGroup);
app.Tab.Title = 'Tab';
% Create Tab2
app.Tab2 = uitab(app.TabGroup);
app.Tab2.Title = 'Tab2';
%% Customize using mlapptools:
pause(5); % might need to be longer, depending on your computer.
[win, widgetID] = mlapptools.getWebElements(app.TabGroup);
... In conclusion - until we find a way to better way to avoid these crashes, you should only use |
Thanks for your answer, but actually it has fixed the issue. I can put Actually, I want to be able to personalize the Tab Group (cf screenshot) (Size of click panel, Selected / Unselected Color, Font, Font Size, Underlying...). Am I able to do this with mlappTools ? |
I didn't try doing anything like that myself, but I expect that it is possible, yes. I would also advise you to use the documented ways to edit components as much as possible, and only when you reach their limit, switch to |
Actually, the documented way doesn't offer any possibility to customize the Today I tried the 'manual' way to retrieve tags and ID and the issue is the same, and appear only with the
|
If you have to use methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
start(timer('TimerFcn', @(x,y)app.customizeElements(), 'StartDelay', 10));
end
function customizeElements(app)
[hWin, widgetID] = mlapptools.getWebElements(app.TabGroup);
[childIDs] = mlapptools.getChildNodeIDs(hWin, widgetID);
mlapptools.setStyle(hWin, 'background', 'transparent', childIDs(2));
[childIDs] = mlapptools.getChildNodeIDs(hWin, childIDs(2));
mlapptools.setStyle(hWin, 'background', 'black', childIDs(4));
end
end Note that it will only crash if the timer delay is too short. |
Summary
I am having troubles when using the following function :
[win, widgetID] = mlapptools.getWebElements(app.TabGroup);
The issue is quite random. I can have issue 1 or issue 2, you can find below. I don't understand any of them. About issue 2 I looked what has been said about it on Matlab forum, like upgrade driver etc.. But I did it, tried the function on several computer and I still have it.
Problem Description
Issue 1 :
Issue 2 :
Specifications
mlapptools
version 2018The text was updated successfully, but these errors were encountered: