How can I remove the option to close a figure in a ToolGroup?

1 view (last 30 days)
With the snippet of code below I can create a nice looking interface and a figure in which I can create all sorts of controls. However, I'd like to remove the option to close the figure inside it. Is there a way that I can remove the figure title and close button? It's essentially the look the ToolGroup has if there are no figures added.
hToolGroup = matlab.ui.internal.desktop.ToolGroup('MWE');
hToolGroup.disableDataBrowser();
hToolGroup.open();
fig = figure;
hToolGroup.addFigure(fig);
uicontrol(fig, ...
'Style', 'edit', ...
'String', 'A minimal working example' ...
)

Answers (1)

Paras Gupta
Paras Gupta on 14 Sep 2023
Hi,
I understand that you want to hide/remove the close button from the UI Figure tab in the Tool Group created using the provided code.
In MATLAB, there is no built-in way to hide the close button. We can, however, specify the behavior when the close button is pressed by modifying the CloseRequestFcn callback of the created UI Figure. Please refer to the following documentation to learn more about the same.
If you need to have more control over the appearance and behavior of the figure's tab, you might consider creating a custom UI using MATLAB's App Designer. Please refer to the following documentation to gain a comprehensive understanding of App Designer and its functionalities
Hope this helps.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!