Menubar hides and reappears at startup of App Designer App.

24 visualizaciones (últimos 30 días)
Christian Hermann
Christian Hermann el 3 de Feb. de 2022
Respondida: Eric Delgado el 19 de Sept. de 2022
Hi,
Whenever i try to start an app which has a menubar, the menubar dissappears for less than a second and then reapears.
Is there any way to fix this?
I created a Slow Motion Video to showcase my problem.
Code:
classdef app1 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Menu matlab.ui.container.Menu
Menu2 matlab.ui.container.Menu
TabGroup matlab.ui.container.TabGroup
Tab2 matlab.ui.container.Tab
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create Menu
app.Menu = uimenu(app.UIFigure);
app.Menu.Text = 'Menu';
% Create Menu2
app.Menu2 = uimenu(app.UIFigure);
app.Menu2.Text = 'Menu2';
% Create TabGroup
app.TabGroup = uitabgroup(app.UIFigure);
app.TabGroup.Position = [1 1 640 480];
% Create Tab2
app.Tab2 = uitab(app.TabGroup);
app.Tab2.Title = 'Tab2';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end

Respuestas (1)

Eric Delgado
Eric Delgado el 19 de Sept. de 2022
It's a bug. So... there are two ways to deal with it:
  • Report the bug! :)
  • Or... you can create your own graphic menu, controlling your tab object programmatically. For example... in the image below there is a tab object in the background.

Categorías

Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by