On Jan 14, 2012, at 2:43 PM, Robert Purves wrote: > > Brian S wrote: > >> Robert Covington wrote: >> >>> In FB4, the following program correctly -does not- activate the back window on a click in content. >> In Carbon the default behavior for a window with a standard window handler installed is to absorb the click and bring the window forward. >> >> Maybe considering installing a _kEventClassWindow, _kEventWindowGetClickActivation and intercept that in the Window handler instead of the FB’s ON dialog vector. The CEUtil demo ( in Examples/CarbonEvents ) has the basics with a window created with Appearance Window. > > > include "Tlbx Controls.incl" > > local fn WndClickHandler( nextHandler as EventHandlerCallRef, theEvent as EventRef, userData as pointer ) > '~'1 > dim as OSStatus result > dim as ClickActivationResult activation > > result = fn CallNextEventHandler( nextHandler, theEvent ) > activation = _kDoNotActivateAndHandleClick > fn SetEventParameter( theEvent, _kEventParamClickActivation, _typeClickActivationResult, sizeof( activation ), @activation ) > end fn = result When such as that is installed, then the application no longer returns to the foreground when you click on a background document window. One has to add a call to the following or other mechanism if the app is in the background, in the handler, to bring it forward on the click. beginCDeclaration void MakeMeTheFrontProcess(); EndC BeginCFunction void MakeMeTheFrontProcess() { ProcessSerialNumber psn; OSErr err; err = GetCurrentProcess( &psn ); if ( err == noErr ) (void) SetFrontProcess( &psn ); } endC Toolbox MakeMeTheFrontProcess()