Retaining Cut/Copy/Paste without a visible MenuBar

Hi all,

I have a form that acts as a dialog box, prompting the user for some input. Everything on the form is textured graphically, I’ve got it looking just how I want it.

On Windows, the menu bar (File, Edit, etc) completely throws off the look of the form. But without it, the controls lose cut/copy/paste functionality. Even setting the menus .Visible property to False in the open event has no effect, the menubar is still drawn and destroys the aesthetics of my dialog. I’ve even tried setting the .Text property to a blank string - The menu bar is still drawn and you get a little highlight when you mouseover the few pixels where the MenuItem “is.”

Seems the only option on Windows is to set the Menu Bar property to None, but then the controls can’t cut/copy/paste.

On Mac, setting the .Visible property of the menuitems to False does indeed make them invisible, but again, you lose the Cut/Copy/Paste functionality.

Searching both this forum and the old one, there seem to have been many people who have brought this up, but I have yet to see a concrete solution. This seems to be an issue of pretty basic functionality so hopefully there’s an easy fix that I’m just missing.

Does anyone have any insight on how to still be able to have cut/copy/paste on your form WITHOUT any visible menus or menu bars? Windows is the worse of the two because the menubar is actually drawn ON the form.

Thanks!

In that case you need to add cut/copy/paste code yourself. No other workaround.

Instead of setting the menuItems (ie. Cut/Paste etc ) to hidden … have you tried to set the MENU (Edit) to hidden?
I do this quite often (for OSX at least) and it works fine

I have been trying this, but Keyboard.ControlKey always returns false on Windows in a textfield’s KeyDown and I’ve been unable to capture the Ctrl+X/C/V events. Not sure why. I can capture the Command key on a Mac just fine.

[quote=269573:@Dave S]Instead of setting the menuItems (ie. Cut/Paste etc ) to hidden … have you tried to set the MENU (Edit) to hidden?
I do this quite often (for OSX at least) and it works fine[/quote]

Tried this and the cut/copy/paste functionality seems not to work when I set EditMenu.Visible = False (on Mac).

I just quickly tried with a window that has no menu (menu none in the Inspector) : Ctrl-X, Ctrl-C, Ctrl-V work perfectly in a TextField or TextArea with no additional magic.

Interesting, that DOES seem to work for me on Windows as well. I think the difference is in my project I deleted the default menuitems because the menus were displayed on Mac even when the Window had the menu set to none. In any case, I’m close to a solution for my project that I’ll post here.

On Mac I believe you must make sure App has menubar none in order to hide it appwide. Deleting the main menu bar is not a very good idea. Maybe you can create a new project, then copy and paste it back.

Well, I deleted the main menu bar in my Windows test project and Ctrl-X/C/V still work just fine.

For anyone else who simply doesn’t want a menubar in their project at all, you can use this code in your TextField’s KeyDown event to simulate cut/copy/paste/selectall. It does NOT handle Ctrl/Cmd-Z for “undo” (which is a much more complicated operation).

[code] if (TargetWindows or TargetLinux) and keyboard.ControlKey=false then return false
if TargetMacOS and keyboard.OSKey=false then return false

if key=“v” or key.Asc=22 then me.Paste //Handle Ctrl+V / Paste
if key=“c” or key.asc = 3 then me.Copy //Handle Ctrl+C / Copy
if key=“x” or key.asc=24 then //Handle Ctrl+X / Cut
if me.sellength=0 then return true
dim t as string, i, curPos as integer
me.copy
curPos=me.selstart
for i=0 to me.selstart
t=t+mid(me.text, i,1)
next i
for i=me.selstart+me.SelLength+1 to len(me.text)
t=t+mid(me.text, i, 1)
if i>len(me.text) then exit for
next i
me.text=t
me.selstart=curPos
me.selLength=0
end if
if key=“a” or key.asc=1 then //Handle Ctrl+A / Select All
me.selstart=0
me.SelLength=me.text.Len
end if

return true
[/code]

Verified. On Mac if both the window menubar and the app menubar are none, there is simply no menuitems beyond the app menu (next to the apple, that contains the Quit option).

Such a setting will get you rejected in the MAS, though. A while ago I was told by a reviewer my app was rejected because it did not have a Window menu.

I have 4 apps in the MAS and not a single one of them has a Window Menu. MAS acceptance standards are a …er…um…flexible set of rules. :slight_smile:

Indeed, MAS reviewers each seem to have each their pet requirements. When the Window menu reject happened, I already had 3 apps with the same design and no Windows menu in the store.