Any way to hide the primary menu?

For a kiosk app I need to have my own menu.
I’m seeking a solution to remove the DesktopQuitMenuItem or to completely hide the primary app menu that is before File menu.

I cannot find a way.

Set SystemUIVisible to False. DesktopWindow — Xojo documentation

Thanks, I still want the menu bar. I just do not want the Quit menu. it seems to be added automatically when I try to remove it.

One thing that you can do is to prevent the app from quitting if the user isn’t pressing a particular key.

In Window.CancelClose:

If Not Keyboard.ShiftKeyDown then
    Return True
End If

Then the user would have to hold the SHIFT key down while selecting the Quit menu item.

If you use a key that can’t be used in conjunction with a menu, you’ll effectively get what you want.

Found a way using last idea. You can only quit from a secret window where I added a Quit button

I put that in Window.CancelClose of the main code

If Preferences.DisableQuit = “YES” then

If app.AllowQuit = 0 then
Return true
Return False
End if

End If

Note that you can rewrite it like this:

Return App.AllowQuit=0

THanks. I wish you had options like this for the application menu because now I have the problem to remove the Hide menu and I cannot find a way.

Why such function is not available for application menu?

Since you’re apparently on macOS, you could use a declare for this in the Opening event of the window:

Declare Sub canHide lib "foundation" selector "setCanHide:" (win as ptr, value as Boolean)

CanHide(self.Handle, false)

According to the docs, even if the application is hidden, the Window will not.

This last idea is not hiding the window that is good but it select the app on the Finder.

Opera have Cmd-Shift-Q for immediate Quit; otherwise, you get asked if you really want to quit. I strongly dislike that, but sometimes I press Cmd-Q instead of Cmd-A (or whatever…) :wink: