Sorry, I could not communicate with you because the NET was down for
couple of days due to torential rains here in Mumbai (India).
I am reposting the same mail with clarity.
I want to catch the font panel events in my carbon applications(in
XCode). I tried with the code given in the xcode do***entations 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)
{
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 pfclosed",NULL,NULL,0);
break;
}
case kEventFontSelection :
{
StandardAlert(2,"\pselection",NULL,NULL,0);
//status = MyGetFontSelection (event);
break;
}
}
break;
}
default :
{
status = eventNotHandledErr;
break;
}
}
return status;
}


|