Real Software Forums
http://forums.realsoftware.com/

Cocoa: Unable to get a menu on non-main window
http://forums.realsoftware.com/viewtopic.php?f=7&t=47913
Page 1 of 1

Author:  kermit [ Sat May 18, 2013 3:55 am ]
Post subject:  Cocoa: Unable to get a menu on non-main window

I have a registration window in which I would like people to be able to paste their serial number.
Its a movable modal dialog
I have a menu which only contains Paste, and I attach it to the window.

RB 2012R2
In Carbon, the menu is present, and I can paste.
In Cocoa, the menu is not present and paste does not work.

Is this fixed in Xojo?

Author:  DaveS [ Sat May 18, 2013 8:01 am ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

are you using MenuBar1 and Menubar2 where you switch between them dependingon the window you are displaying?

Seems that I read somewhere that Cocoa does not support that (and if that is correct... then Xojo can't "fix" it)

Author:  kermit [ Sat May 18, 2013 2:17 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

So in Cocoa you get one menu and thats it?
Thats progress.
Not.

So I either CANT have paste work on a modal dialog, or the dialog displays a massive irrelevant menu?
Which new Apple guidelines say you shouldnt hide but just disable bits from?

Urgh.

Surely there must be a way to allow paste to work without having a menu attached to a window, then?
Its just paste...

Author:  DaveS [ Sat May 18, 2013 2:24 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

sure... intercept Cmd-V (or Cntrl-V) depending on platform in Keydown and manipulate the clipboard yourself.

Author:  kermit [ Sat May 18, 2013 2:29 pm ]
Post subject:  Re: Cocoa: How to make PASTE work without a menu

OK..
Out of the box thinking then..

If its a text box, and someone presses V with the right keyboard option, we need to paste the clipboard..

This appears to work in the keydown event

dim c as new Clipboard
if (key = "v" or key = "V" )and Keyboard.AsyncMenuShortcutKey and c.TextAvailable then
me.Text = C.Text
end if

Author:  timhare [ Sat May 18, 2013 2:42 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

kermit wrote:
So in Cocoa you get one menu and thats it?

I don't think that's entirely accurate. Others will have to chime in here. The real issue is you can't have more than one instance of a menu item. You have to clone them to create the second menu. Carbon allows you to reuse menuitems. Cocoa does not.

Author:  npalardy [ Sat May 18, 2013 2:49 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

DaveS wrote:
Seems that I read somewhere that Cocoa does not support that (and if that is correct... then Xojo can't "fix" it)

kermit wrote:
So in Cocoa you get one menu and thats it?
Thats progress.
Not.


dave is incorrect - you can use many menu bars

try it

and yes if you enable the paste item it should work just fine

Author:  kermit [ Sat May 18, 2013 3:09 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

Quote:
dave is incorrect - you can use many menu bars
try it


Did
Doesn't.
Hence the post.

There is a clear difference between Cocoa and Carbon: I only have to change the build settings to lose the menu.
Its not a question of 'menus dont work'
The menu doesn't even appear.

Author:  npalardy [ Sat May 18, 2013 3:36 pm ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

kermit wrote:
Quote:
dave is incorrect - you can use many menu bars
try it


Did
Doesn't.
Hence the post.

There is a clear difference between Cocoa and Carbon: I only have to change the build settings to lose the menu.
Its not a question of 'menus dont work'
The menu doesn't even appear.


Odd as I also tried it with a movable modal before posting and it switched the menu bar just fine & enabled the paste item which then worked
Can't imagine what you're doing differently ?

Author:  atarikid [ Sun May 19, 2013 4:08 am ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

This is (was) a bug. It works fine now with Xojo.

Author:  kermit [ Sun May 19, 2013 5:56 am ]
Post subject:  Re: Cocoa: Unable to get a menu on non-main window

Quote:
This is (was) a bug. It works fine now with Xojo.


Thank you.
I expect thats what Norman is using.
But this is what I needed to know.
The CMD-V option is actually a better one for me now, so the panic is over for the moment.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/