Mailing Lists: Apple Mailing Lists

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

Using Carbon Events in a Cocoa app



Hi,

I'm trying to run the QT Standard Effects dialog from Cocoa,
which requires running a WaitNextEvent loop. The code I'm
currently using is below.

I've got one main problem with this. When the dialog comes up,
it draws the whole dialog fine, but then for some reason
immediately erases the content area (the area that lets you edit
the effect). There are other issues, like being able to select
menu commands and raise other windows.

Also, kEventDurationForever should change, because filter
previews like Film Noise don't animate unless if you move the
mouse.


- (BOOL) _runDialogInEventLoop:(QTParameterDialog)dialogID
{
EventRef theEvent;
EventTargetRef theTarget;
EventRecord theRecord;
OSErr result;
BOOL done = NO;
BOOL useEffect = NO;

theTarget = GetEventDispatcherTarget();

while (ReceiveNextEvent(0, NULL, kEventDurationForever,true,
&theEvent) == noErr
&& done == NO)
{
//check if it's an event for the dialog.
ConvertEventRefToEventRecord(theEvent, &theRecord);

result = QTIsStandardParameterDialogEvent(&theRecord, dialogID);
switch (result)
{
case featureUnsupported:
SendEventToEventTarget(theEvent, theTarget);
break;

case codecParameterDialogConfirm:
QTDismissStandardParameterDialog(dialogID);
useEffect = YES;
dialogID = nil;
done = YES;
break;

case userCanceledErr:
QTDismissStandardParameterDialog(dialogID);
dialogID = nil;
done = YES;
break;
}

ReleaseEvent(theEvent);
}

return useEffect;
}

Thanks for any help,

Sarwat.


{sarwat khan : email@hidden : http://sarwat.net}




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.