I want to catch the font panel events in my carbon applications(in
XCode). I tried with the code given in the xcode documentations but I am
not able to catch the event. I am giving code bellow. Please look at it
and suggest. regards sanjay
// DEFINING EVENT TYPES
const EventTypeSpec events[]= {
{kEventClassFont,kEventFontPanelClosed},
{kEventClassFont,kEventFontSelection},
{kEventClassCommand,kEventCommandProcess} }; // INSTALLING THE
EVENT HANDLLER OSStatus status = InstallWindowEventHandler (window,
NewEventHandlerUPP (MyApplicationEventHandler),
GetEventTypeCount(events), events,(void*) window, NULL); // EVENT
HANDLLER PROC pascal OSStatus MyApplicationEventHandler
(EventHandlerCallRef myHandler, EventRef event, void *userData) {
OSStatus status = eventNotHandledErr; HICommand command; UInt32
eventClass; UInt32 eventKind; eventClass = GetEventClass(event);
switch (eventClass) { case kEventClassCommand : {
GetEventParameter (event, kEventParamDirectObject, typeHICommand,
NULL,sizeof (HICommand), NULL, &command); switch
(command.commandID) { case kHICommandShowHideFontPanel : //
'shfp' { status = FPShowHideFontPanel(); if
(FPIsFontPanelVisible()) { } else {
} break; } } break; } case
kEventClassFont : { eventKind = GetEventKind (event); switch
(eventKind) { case kEventFontPanelClosed : {
StandardAlert(2,"\p kEventFontPanelClosed",NULL,NULL,0); break;
} case kEventFontSelection : { StandardAlert(2,"\p
kEventFontSelection",NULL,NULL,0); //status = MyGetFontSelection
(event); break; } } break; } default : { status
= eventNotHandledErr; break; } } return status; }


|