Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing the signature of a window




On Jan 29, 2005, at 4:00 PM, Laurence Harris wrote:

On 1/29/05 6:22 PM, Mike Lazear didst favor us with:
Why do you need a kEventControlHit handler on the window? The OK button
should handle all tracking and just send a kHICommandOK event when the user
clicks it.

If I remember right from previous discussions you add a control event handler to
many of your controls on a window. For most of my windows I don't need to do
that. I just add one handler for the entire window. I usually only attach a
couple of events, like what I'm doing in this particular case.


The method that I'm using is quite common in the sample code programs.

This particular window has 4 text boxes and 3 buttons. I don't need to check
anything on the text boxes other than a filter has been added to make sure
the user only types in numbers. The buttons are detected in my event handler
and the necessary calls are made.


One way to detect buttons is to assign a command ID to each button and then
check for that in a switch statement within the event handler. In my case I
assign an ID to each and check that instead. I always assign OK and Cancel
buttons with their proper command ID but the other buttons I've left the command ID
as blank since I don't use them.


Using the method of checking control IDs instead of command IDs I need to
watch for kEventControlHit events to know when buttons are clicked.


On some windows where I need low-level handling of controls I attach a
control event handler.

I can't help but wonder if your design is what it should be if you have a
kEventControlHit handler installed on the window handling an OK button. I've
never heard of that before and I can't imagine why you'd want to handle it
that way.


I have 50+ windows in my application. I install only a handful of
kEventControlHit handlers, and in every case I install them on the controls
that need them.

I'm guessing that you must be assigning command IDs to all buttons on your
windows to know when they are pressed.


Yes, I sleep just sleep at odd hours by most people's standard and they
change from day to day.

Since this is an international mailing list I guess odd hours depends upon
where one is located.


Mike

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Changing the signature of a window (From: Laurence Harris <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.