• 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
Binding <enter> key to different action in a textview?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding <enter> key to different action in a textview?


  • Subject: Binding <enter> key to different action in a textview?
  • From: Jerry LeVan <email@hidden>
  • Date: Sat, 14 Feb 2004 12:56:00 -0500

Hi, I have a text window that contains some sql and I would like to bind the enter key
to something other than insertNewLine: (in a simple way :). I want to keep the return key
action unchanged.

My intent is grab any "selected" code and send it to the sql backend when the enter key is hit.

One strategy that might work would be to implement textView:doCommandBySelector and when
insertNewLine: is detected examine [NSApp currentEvent] and look at the keycode.

It appears that the keycode (by experimentation) for return is 36 and the keycode for enter is 76.

I am leary of hard coding the numbers but have nat been able to find "symbolic" names for the key codes
that might track changes to the keycodes ( I am not even sure that the keycodes are keyboard independent).

Is hard coding the keycode value the only way to do this task?

--jerry
_______________________________________________
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: Autoresize after setBounds
  • Next by Date: NSComoBox's pop-up list text/background color?
  • Previous by thread: Re: General Question: Debugging these "NS" Objects
  • Next by thread: Stepper inside table view
  • Index(es):
    • Date
    • Thread