Is there a way to somehow emulate Cmd + ~ shortcut behaviour (i.e. cycling through an application windows) in Cocoa?
I was able to do this in Carbon by doing the following:
HICommand cmd;
cmd.attirbutes = kHICommandFromMenu;
cmd.commandID = kHICommandRotateWindowsForward;
::GetIndMenuItemWithCommandID( NULL, cmd.commandID, 1, &(cmd.menu.menuRef), &(cmd.menu.menuItemIndex));
::ProcessHICommand(&cmd);
But now I need to do this in Cocoa and can’t find a way 🙂
Googled something about a “private method _cycleWindows in NSApplication”, which seems to do exactly what I need, but the code
[[NSApplication sharedApplication] _cycleWindows];
won’t compile – “wrong method signature”.
Using _cycleWindows is the correct thing to do. Try this:
Also, if you want to emulate Cmd+Shift+~ then do: