Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CPTextField + NibApplication: Without menu items Cmd-V wont call paste: #1434

Closed
Toxe opened this Issue · 10 comments

6 participants

Tobias Brückner CappBot daboe01 Alexander Ljungberg Ross Boucher Andrew Hankinson
Tobias Brückner

I am not sure if this really qualifies as a bug, but I wanted to report it anyways, because I can imagine other people running into this problem as well.

If you generate a new application using the capp gen NibApplication template and afterwards in InterfaceBuilder remove the menu bar from your NIB file, paste and cut wont work any longer with CPTextField. Cmd-V and Cmd-X should invoke the paste: and cut: messages of CPTextField but this only works as long as the menu bar with its Paste and Cut menu items exists. And without invoking the paste: and cut: messages CPTextField wont send its textDidBeginEditing, textDidChange, ... notifications, which is a big problem if you are using bindings.

A simple workaround would be to manually add the key bindings in applicationDidFinishLaunching:

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
  // This is called when the application is done loading.
  [CPKeyBinding cacheKeyBinding:[[CPKeyBinding alloc] initWithPhysicalKeyString:@"@v" selectors:[CPArray arrayWithObject:@"paste:"]]];
  [CPKeyBinding cacheKeyBinding:[[CPKeyBinding alloc] initWithPhysicalKeyString:@"@x" selectors:[CPArray arrayWithObject:@"cut:"]]];
}

After this paste and cut works as it should.

CappBot
Collaborator

Labels: #needs-patch, #new, AppKit, bug. What's next? This issue needs a volunteer to write and submit code to address it.

daboe01

this bug most likely is also responsible for the lack of Cmd-N opening a new browser window without a menu (confirmed for Safari and FF).

Alexander Ljungberg
Owner

Actually in Cocoa I'm pretty sure that if you remove the menu entirely of an app, cut and paste no longer works at all.

Ross Boucher
Collaborator
daboe01

just curious, why is is browser-native shortcut new window (cmd-N) also blocked without menu?
this results in the user beeing locked in, certainly not expected behaviour.

daboe01

thanks ross, adding empty menu + [CPMenu setMenuBarVisible:NO] fixed the cmd-N issue for me. best greetings, daniel

Andrew Hankinson

Has this issue been fixed with #1757?

-#new
milestone=0.9.7

CappBot
Collaborator

Milestone: 0.9.7. Labels: #needs-patch, AppKit, bug. What's next? This issue needs a volunteer to write and submit code to address it.

Andrew Hankinson

I have just tested this by creating a new NibApplication and deleting the menubar. Cmd-V works to paste into a CPTextField.

+#fixed

CappBot
Collaborator

Milestone: 0.9.7. Labels: #fixed, AppKit, bug. What's next? This issue is considered successfully resolved.

CappBot cappbot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.