extra uitoolbar in GUI figure (R2023b)

2 views (last 30 days)
Just download the R2023b. In the figure I have developped (using GUIDE), there is a full toolbar that I did not create appears as a second toolbar.
I read through the release note and did not find anything about it.
Is it normal? What is the correct way to remove the toolbar or prevent this to happen (my preferable solution).
  2 Comments
Rik
Rik on 15 Sep 2023
Perhaps the internal black magic from GUIDE is finally breaking?
The solution (for the removal) is probably to put something in the OpeningFcn, but that is a blind guess (I wasn't aware of R2023b until this morning).
Bruno Luong
Bruno Luong on 15 Sep 2023
Edited: Bruno Luong on 15 Sep 2023
Yes, so I have this little function that I put in OpeningFcn that does the job.
function RemoveMatlabToolbar(fig)
% RemoveMatlabToolbar(fig)
% Since R2023b MATLAB GUI add a separate toolbar in the figure
% If you don't want it, call this function in your OpeningFcn
try %#ok
if ~isMATLABReleaseOlderThan("R2023b")
h = findall(fig,'Type','uitoolbar');
%if numel(h) >= 2
Tag = get(h,'Tag');
b = strcmp(Tag,'FigureToolBar'); % This seems to be the default Tag of MATLAB toolbar
delete(h(b));
%end
end
end
end % RemoveMatlabToolbar
But I have quite a umber of GUI figures i many projects. I would like to have the solution to turn off those damn unsollicited toolbars by default.
Oh well, not sure why TMW does this kind of things...

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 15 Sep 2023
Edited: Adam Danz on 15 Sep 2023
To try to reproduce this behavior, I created a bare-bones gui in R16b and opened it in R23b but the GUI figure does not show any figure toolbar. Please consider contacting tech support and provide them with the GUI files. Or, if you attach them here, I'd be happy to take a look.
In the meantime, does this remove the unwelcomed toolbar?
fig.ToolBar = 'none';
Update @Bruno Luong thanks for digging in. This is due to a change in addToolbarExplorationButtons.
I will send your feedback to the appropriate channels.
  7 Comments
Adam Danz
Adam Danz on 20 Sep 2023
Edited: Adam Danz on 20 Sep 2023
@Bruno Luong, could we have more information about your intentions and expectations for this line? Feel free to respond here or contact me directly using the contact button in my profile.
set(groot,'defaultFigureCreateFcn',@(fig,dummy)addToolbarExplorationButtons(fig));
Bruno Luong
Bruno Luong on 21 Sep 2023
Edited: Bruno Luong on 21 Sep 2023
The reason is I don't like the default behavioir of interactive axes toolbar (those icon which appears and disappears on the right sides) so I disable them and restore the figure toolbar everytime I open a new figure, I put this line in my startup file, see this discussion (my post on 16 Sep 2019)
My workaround of the issue in R2023b is that is I try to detect if the figure is assotiated with GUI or not by this code that in principle add the figure toolbar on the standard figure and not GUI figure (it works OK but not very robust):
function AddExporerButtonToFig(fig)
try %#ok
if ~(matlab.ui.internal.isUIFigure(fig)) && ...
~strcmp(fig.HandleVisibility,'callback') && ~isempty(fig.Number)% NOT a GUI, or check like this % isprop(fig,'AutoListeners__')
addToolbarExplorationButtons(fig);
end
end
end

Sign in to comment.

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!