필터 지우기
필터 지우기

Menubar hides and reappears at startup of App Designer App.

조회 수: 8 (최근 30일)
Christian Hermann
Christian Hermann 2022년 2월 3일
답변: Eric Delgado 2022년 9월 19일
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

답변 (1개)

Eric Delgado
Eric Delgado 2022년 9월 19일
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.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by