Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Hide Matlab IDE menu bar

Subject: Hide Matlab IDE menu bar

From: Matt Dunham

Date: 23 Jun, 2010 00:10:22

Message: 1 of 7

I'd like to hide the Matlab IDE menu bar, i.e. the bar at the top that has "file", "edit", "debug", etc, to save screen realestate. The following code almost does it:

I = com.mathworks.mde.desk.MLDesktop.getInstance
I.getMainFrame.getJMenuBar.setVisible(0)

except that the bar reappears whenever you click on the editor or back onto the command window. Anyone know how to turn this off?

Subject: Hide Matlab IDE menu bar

From: Jan Simon

Date: 23 Jun, 2010 16:38:06

Message: 2 of 7

Dear Matt,

> I'd like to hide the Matlab IDE menu bar, i.e. the bar at the top that has "file", "edit", "debug", etc, to save screen realestate. The following code almost does it:
> I = com.mathworks.mde.desk.MLDesktop.getInstance
> I.getMainFrame.getJMenuBar.setVisible(0)
> except that the bar reappears whenever you click on the editor or back onto the command window. Anyone know how to turn this off?

Sorry for not answering.
What do you want to achieve by hiding the menubar??

Jan

Subject: Hide Matlab IDE menu bar

From: Matt Dunham

Date: 23 Jun, 2010 21:05:21

Message: 3 of 7

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hvtd9e$844$1@fred.mathworks.com>...
> Dear Matt,
>
> > I'd like to hide the Matlab IDE menu bar, i.e. the bar at the top that has "file", "edit", "debug", etc, to save screen realestate. The following code almost does it:
> > I = com.mathworks.mde.desk.MLDesktop.getInstance
> > I.getMainFrame.getJMenuBar.setVisible(0)
> > except that the bar reappears whenever you click on the editor or back onto the command window. Anyone know how to turn this off?
>
> Sorry for not answering.
> What do you want to achieve by hiding the menubar??
>
> Jan

Increased screen real estate. I'm working on a small laptop, and I almost never use the menubar. Ideally, there would be a keyboard shortcut to hide and reveal it.

Subject: Hide Matlab IDE menu bar

From: Jan Simon

Date: 23 Jun, 2010 23:05:08

Message: 4 of 7

Dear Matt,

I tried it hard to increase the window size until the menubar is out of the screen:
  frame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
  frame.setBounds(-4, -44, 1040, 900);
But, unfortunately, this does not increase the width to more than 780 pixels on my 1024x768 monitor. Note: 780 versus 768 ?!
No success for frame.setSize, frame.setMaximumSize, frame.reshape also.

There is the ugly behaviour of Matlab figures on Windows, which prevent setting the property 'Position' to the complete visible screen size:
  figure('Position', [0, 0, 1023, 767])
Moves the figure to unexpected locations.
But this can be solved by calling the Windows-API function SetWindowPos together with the SWP_NOSENDCHANGING flag in a C-Mex. In combination with the HWND_TOPMOST flag, I got the full visible screen.
Nevertheless, I did not try to use it to resize the main frame and I do not know a solution for Linux.

Yair, we need your advice.

Jan

Subject: Hide Matlab IDE menu bar

From: Yair Altman

Date: 24 Jun, 2010 05:50:09

Message: 5 of 7

> I tried it hard to increase the window size until the menubar is out of the screen:
> frame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
> frame.setBounds(-4, -44, 1040, 900);
[...]
> Yair, we need your advice.


To the rescue:

    jDesktopFrame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
    jDesktopMenu = jDesktopFrame.getRootPane.getMenuBar;
    jDesktopMenu.setVisible(0);
    jDesktopMenu.repaint;

Yair Altman
http://UndocumentedMatlab.com

Subject: Hide Matlab IDE menu bar

From: Matt Dunham

Date: 25 Jun, 2010 02:49:05

Message: 6 of 7

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message <hvurmh$omi$1@fred.mathworks.com>...
> > I tried it hard to increase the window size until the menubar is out of the screen:
> > frame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
> > frame.setBounds(-4, -44, 1040, 900);
> [...]
> > Yair, we need your advice.
>
>
> To the rescue:
>
> jDesktopFrame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
> jDesktopMenu = jDesktopFrame.getRootPane.getMenuBar;
> jDesktopMenu.setVisible(0);
> jDesktopMenu.repaint;
>
> Yair Altman
> http://UndocumentedMatlab.com

Thanks Yair, except the menu reappears whenever you change the focus from the command window to the editor, or any other matlab window.

Subject: Hide Matlab IDE menu bar

From: Yair Altman

Date: 25 Jun, 2010 06:45:31

Message: 7 of 7

> > > I tried it hard to increase the window size until the menubar is out of the screen:
> >
> > jDesktopFrame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame;
> > jDesktopMenu = jDesktopFrame.getRootPane.getMenuBar;
> > jDesktopMenu.setVisible(0);
> > jDesktopMenu.repaint;
> >
>
> Thanks Yair, except the menu reappears whenever you change the focus from the command window to the editor, or any other matlab window.

It doesn't on my R2010a...
Anyway, you can always do this (or variants thereof):

  hDesktopFrame = handle(jDesktopFrame,'CallbackProperties');
  set(hDesktopFrame, 'WindowGainedFocusCallback', @(h,e) jDesktopMenu.setVisible(0));

Yair Altman
http://UndocumentedMatlab.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us