Hiding the main menu and dock [SOLVED]
lazarus / 33-macOS - Mac OS X
----------------------------------------------------------------------
VTwin · 2011-04-11 19:46
I am writing an application that requires a full screen display of
images, and am trying to figure out how to hide the main menu and
dock. I can make it full screen, but can't hide the menu.
Adding:
LSUIPresentationMode
4
to my bundle Info.plist correctly does what I want, but the menu and
dock remain hidden all the time. I would like to be able to hide them
only while the show is in progress.
Does anyone know how to turn LSUIPresentationMode on and off in code?
Any tips appreciated.
Cheers,
Frederick
----------------------------------------------------------------------
Jonas Maebe · 2011-04-11 20:09
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/
Conceptual/QuartzDisplayServicesConceptual/Articles/DisplayCapture.htm
l
----------------------------------------------------------------------
VTwin · 2011-04-11 21:06
Thanks jmaebe,
This looks potentially useful, but I am currently using TBGRABitmap to
draw into a TImage TCanvas. If I were to try this technique, I
presumably have to copy a bitmap to the display. I'm not at all sure
how to do that.
I'd prefer their second approach, which is to "create and draw into a
borderless window the size of the display". This also seems safer than
taking over the display. I'm hoping there is a simple system call to
turn on display mode.
Cheers,
Frederick
----------------------------------------------------------------------
typo · 2011-04-11 22:42
You can assign an empty menu.
----------------------------------------------------------------------
VTwin · 2011-04-11 23:06
typo,
An 'empty' menu still shows up as a menu bar with the Apple system
item and the application name, as well as all the other icons on the
right. Am I not understanding your suggestion?
Is there some way to assign a nil menu in code?
Thanks,
Frederick
----------------------------------------------------------------------
typo · 2011-04-11 23:19
On my Windows system, assigning Form1.Menu as nil does not even make
the previous menu to disappear, but it does not repaint anymore.
----------------------------------------------------------------------
VTwin · 2011-04-12 00:04
Quote from: typo on April 12, 2011, 01:19:30 amOn my Windows system,
assigning Form1.Menu as nil does not even make the previous menu to
disappear, but it does not repaint anymore.
I see what you mean. I just gave that a try, but the default menu
still shows up. You can select items from it, but it gives an access
error. A good idea, but no go on OS X.
Thanks,
Frederick
----------------------------------------------------------------------
VTwin · 2011-06-08 15:06
In poking around the web I found the OS X system calls required to do
this here:
http://developer.apple.com/library/mac/#technotes/tn2002/tn2062.html
The call is this:
OSStatus SetSys]"]>BlockedIMode(
Sys]"]>BlockedIMode inMode,
Sys]"]>BlockedIOptions inOptions);
My knowledge of implementing system calls in Lazarus is nil, but it
seems like it should not be too difficult. Can anyone point me in the
right direction?
Cheers,
Frederick
----------------------------------------------------------------------
Jonas Maebe · 2011-06-08 15:12
Quote from: Frederick on June 08, 2011, 05:06:02 pmThe call is this:
OSStatus SetSys]"]>BlockedIMode(
Sys]"]>BlockedIMode inMode,
Sys]"]>BlockedIOptions inOptions);
My knowledge of implementing system calls in Lazarus is nil, but it
seems like it should not be too difficult. Can anyone point me in the
right direction?
It's available via the FPC MacOSAll unit. An alternative set of calls
to use is BeginFullScreen() and EndFullScreen().
----------------------------------------------------------------------
VTwin · 2011-06-08 16:46
Quote from: jmaebe on June 08, 2011, 05:12:22 pmIt's available via the
FPC MacOSAll unit. An alternative set of calls to use is
BeginFullScreen() and EndFullScreen().
Beautiful!!! This does just what I need:
Code: [Select]if startFullScreen then
SetSys]"]>BlockedIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar)
else
SetSys]"]>BlockedIMode(kUIModeNormal, 0);
Thank you so much jmaebe.
Cheers,
Frederick