View Single Post
Old 02-10-2017, 05:35 PM   #1
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default Handling arrow keys in a text control

Question: Is there a way to handle special keys while editing a field (ITextControl)?

The answer appear to be "No", at least for OS X.

I want to handle up/down arrow keys to increment and decrement the field's value. The user can type a value (milliseconds), and bump the value in 10 ms increments with the up/down arrows.

The immediate solution for OS X appears to be implementing doCommandBySelector. (I don't know Cocoa at all, so there remains the hurdle of figuring out exactly how to work that in. Edit: OK, that was really easy.)

I haven't looked at the Windows side. It seems that the text fields should be handled in a more generic way instead of handing off to a platform-specific control, but I'm not going to head down that path at this point of trying to ship a product.

Comments? Ideas? Thanks...

Edit: Maybe I should have stated that differently. I'm not stuck, just don't want to recreate something that might have already been done in a branch, or if I'm going to submit a change, want to do it in a way that will be most helpful.

Last edited by earlevel; 02-10-2017 at 08:14 PM.
earlevel is offline   Reply With Quote