New topic: 

Cocoa: Unable to get a menu on non-main window

<http://forums.realsoftware.com/viewtopic.php?t=47913>

         Page 1 of 1
   [ 9 posts ]                 Previous topic | Next topic          Author  
Message        kermit          Post subject: Cocoa: Unable to get a menu on 
non-main windowPosted: Sat May 18, 2013 3:55 am                         
Joined: Mon May 30, 2011 12:56 am
Posts: 696                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?   
                             Top                DaveS          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 8:01 
am                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4890
Location: San Diego, CA                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)      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                kermit          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 2:17 
pm                         
Joined: Mon May 30, 2011 12:56 am
Posts: 696                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...   
                             Top                DaveS          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 2:24 
pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4890
Location: San Diego, CA                sure... intercept Cmd-V (or Cntrl-V) 
depending on platform in Keydown and manipulate the clipboard yourself.      
_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                kermit          Post subject: 
Re: Cocoa: How to make PASTE work without a menuPosted: Sat May 18, 2013 2:29 
pm                         
Joined: Mon May 30, 2011 12:56 am
Posts: 696                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
   
                             Top                timhare          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 2:42 
pm                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12340
Location: Portland, OR  USA                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.   
                             Top                npalardy          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 2:49 
pm                       Real Software Engineer          
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7840
Location: Canada, Alberta, Near Red Deer                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      
_________________
Norman Palardy (Real Software)  
                             Top                kermit          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 3:09 
pm                         
Joined: Mon May 30, 2011 12:56 am
Posts: 696                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.   
                             Top                npalardy          Post subject: 
Re: Cocoa: Unable to get a menu on non-main windowPosted: Sat May 18, 2013 3:36 
pm                       Real Software Engineer          
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7840
Location: Canada, Alberta, Near Red Deer                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 ?      
_________________
Norman Palardy (Real Software)  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 9 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to