• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best way to defy logic of NSTextField editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best way to defy logic of NSTextField editing


  • Subject: Best way to defy logic of NSTextField editing
  • From: Daniel Jalkut <email@hidden>
  • Date: Wed, 21 Jan 2004 11:15:25 -0800

I'm still on my "how to best implement Apple-style hotkey editing" crusade. I've got things working pretty well by providing a subclassed field editor, and passing all events to it from my NSApp sendEvent: method. I use "performKeyEquivalent:" even though it feels wrong, because it returns a boolean and keyDown: doesn't.

This is all fine and dandy - I'm able to capture most keystrokes. I have a "KeyStrokeCombo" class that archives the modifiers and virtual key, and provides a "description" that looks like what you'd expect to see in a text field. Whenever the user hits a reasonable key combo, I create a new KeyStrokeCombo and ask it for the description, which goes in the field editor.

The problem with this approach is that I need to keep the "KeyStrokeCombo" around somehow so the client can ultimately use it instead of the text value to commence with useful activities. The text representation of the key combination is not sufficient to reproduce the correct combo, because there is more than one way to generate some keystrokes, and I have no way of knowing what the original virtual character code was.

I would like to implement this in a "field editor / NSFormatter / general cell editing" savvy kind of way. The problem is, NSFormatter has a presumption that all text representations can be used to reconstitute their represented objects. I can't conform to that unless I mangle my string and encode the original character code instead of the text.

I'm intrigued by the possibility of essentially having a cell that has as its object my KeyStrokeCombo, but with the NSFormatter limitations above, can this be done? I feel like I could paw at answers a lot more, but it would be great if anybody has some advice on the best course of action.

Daniel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Small animation
  • Next by Date: Re: Small animation
  • Previous by thread: PDF with background transparent?
  • Next by thread: Programmatically setting a radio button
  • Index(es):
    • Date
    • Thread