Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Not receiving kEventCommandProcess in edit control
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not receiving kEventCommandProcess in edit control




On Jun 26, 2007, at 12:29 PM, Dan Spirlock wrote:

Hi Larry,

Thanks for the response. I tried installing a window event handler, as you suggested, but I still had the same problem as before. Someone else suggested using kEventTextShouldChangeInRange, but this requires OS 10.4 and I need to support back to 10.2. To answer your question of what I'm trying to do - The dialog is a registration form that takes a serial number. The serial numbers are formatted into blocks of characters separated by dashes. The dialog has a separate edit field for each block of characters. I want to be able to catch the paste command and take the entire serial number string from the clipboard, split it and place it into the separate edit fields. Is there a better way to accomplish what I'm trying to do?

Better than what, the thing that isn't working? ;-)

I went back and looked at my code I had confused a couple of things. Sorry about that. Seems my kEventCommandProcess handler *is* called for kHICommandPaste. What I was confused about is that even if you disable the Paste/Copy/Cut commands in a kEventCommandUpdateStatus handler, the control will handle the them anyway. The upshot is that a more informed answer is: it works for me. Off the top of my head I don't see why your handler wouldn't get called unless you install another handler later that's returning noErr.

Larry



Thanks, Dan Spirlock BIAS, Inc. http://www.bias-inc.com


On Jun 25, 2007, at 5:01 PM, Laurence Harris wrote:


On Jun 25, 2007, at 3:06 PM, Dan Spirlock wrote:

Hello,

This is probably a very basic question, but I haven't found any information in the documentation or in the mailing lists. I have a movable modal dialog that is using edit controls via Control Manager. I've installed a Carbon event handler on the edit controls to catch paste events from the user. The problem is that when I do any sort of cut, copy, or paste via the keyboard, my event handler function is never called.

My event handler code looks like this:

EventHandlerUPP PasteEventHandler = NewEventHandlerUPP (HandlePasteEventProc);
EventTypeSpec theEvent;
theEvent.eventClass = kEventClassCommand;
theEvent.eventKind = kEventCommandProcess;


InstallControlEventHandler(theCtrlRef, PasteEventHandler, 1, &theEvent, NULL, NULL);

I've installed event handlers for other types of events, and those are working. It is just the kEventClassCommand types that I'm having trouble with.

I haven't worked with this for a while now, but IIRC those events are being handled at the window level if you have the standard window handler installed or some such thing. Try installing the handler on the window and see if it gets called there.


What exactly are you trying to accomplish with this handler? There may be other ways to do what you want to do.

Larry







_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Not receiving kEventCommandProcess in edit control (From: Dan Spirlock <email@hidden>)
 >Re: Not receiving kEventCommandProcess in edit control (From: Laurence Harris <email@hidden>)
 >Re: Not receiving kEventCommandProcess in edit control (From: Dan Spirlock <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.