Carbon View Events
Carbon View Events
- Subject: Carbon View Events
- From: "Jeremy Jurksztowicz" <email@hidden>
- Date: Thu, 02 Jun 2005 20:29:48 +0000
Hello,
I am writing an audiounit with both a carbon and a cocoa view.The cocoa view has the real user interface. In the event that only the carbon view can be hosted (unfortunately common) I would like to present a button which allows the user to load a preset created in the cocoa view. The preset is not standard AU preset that the host handles, so I would like to intercept the button push and open a standard open dialog box in response. I see that the carbon view base, handles mapping parameters to controls, but I don't understand how to actually intercept the gui events properly. Please excuse my ignorance if this is really simple, I am good with cocoa, but usless with carbon. Here is my code so far:
OSStatus MYAUView::CreateUI(Float32 xoffset, Float32 yoffset)
{
ControlRef button;
Rect buttonBounds = {0, 0, 100, 50};
OSStatus res = CreatePushButtonControl (
this->GetCarbonWindow(),
&buttonBounds,
CFSTR("Load Preset"),
&button);
if(res == noErr) {
_loadButton = button;
this->EmbedControl(button);
}
SizeControl(mCarbonPane, 100, 50);
return noErr;
}
bool MYAUView::HandleEvent(EventRef event)
{
UInt32 eclass = GetEventClass(event);
UInt32 ekind = GetEventKind(event);
if(eclass == kEventClassControl)
{
if(ekind == kEventControlClick)
{
ControlRef control;
GetEventParameter(event,
kEventParamDirectObject,
typeControlRef, NULL, sizeof(ControlRef), NULL, &control);
if(control == _loadButton)
{
// DO CUSTOM WORK
return true;
}
}
}
return AUCarbonViewBase::HandleEvent(event);
}
This compiles all right, but the button does not give any visual feedback of being pressed, and the custom code is not called, so... beats me!?
Thank you,
Jeremy Jurksztowicz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden