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: kEventControlHit and Check box



Which checkbox control variation are you using? Normal? Or Auto-Toggle?

I use Auto-Toggle and when I do the same thing the new control value is
there, though I've never actually done what you're trying to do with calling
the next event handler first.

Are you using the standard window event handler? I didn't realize it had a
handle for kEventControlHit as that event is pretty high up the food chain.
Generally, you shouldn't have to call through to the standard handler for
ControlHit.


Bryan

> ----------
> From: Jerry
> Sent: Monday, August 18, 2003 11:34 AM
> To: email@hidden
> Subject: kEventControlHit and Check box
>
> Hi,
>
> I'm converting an old application to Carbon and I have a problem with
> Check box controls: In my Carbon event handler for kEventControlHit, I
> get the check box value, but the value I get is the value before the
> click, not after. I have the same code for Sliders, scrollbars, bevel
> buttons (with toggle behaviour) and Tabs controls and it works fine for
> all of these, just not for check boxes. Does anyone have any idea what
> I'm doing wrong? Here's the (simplified to protect the innocent) code:
>
> void CheckBox::InstallEventHandler()
> {
> OSStatus status;
> static const EventTypeSpec events[] = {
> { kEventClassControl, kEventControlHit },
> };
>
> static EventHandlerUPP event_handler_UPP = NULL;
> if ( event_handler_UPP == NULL )
> event_handler_UPP = NewEventHandlerUPP( EventHandler );
> status = ::InstallControlEventHandler( GetControl(),
> event_handler_UPP,
> GetEventTypeCount(events), events, this, NULL );
> }
>
> pascal OSStatus CheckBox::EventHandler(EventHandlerCallRef handlerRef,
> EventRef event, void* userData)
> {
> CheckBox *button = (CheckBox *)userData;
> int value = ::GetControlValue( button->GetControl() ); // This
> returns
> the wrong value
> ::CallNextEventHandler(handlerRef, event); //
> adding this in makes
> no difference
> value = ::GetControlValue( button->GetControl() );
> return eventNotHandledErr;
> }
>
> Jerry
> _______________________________________________
> carbon-development mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/carbon-development
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



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.