[futurebasic] Browser in standard handler window

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2006 : Group Archive : Group : All Groups

From: Bernie <spam.me.and.i.will.kill.you@...>
Date: Thu, 16 Feb 2006 10:29:00 +0000
Couple of annoying 'features' with a data browser in a window with  
the standard handler attribute.

When the owning window is *not* frontmost:
1. The scrolling trackpad scrolls the browser. [I'm assuming the same  
happens with the mouse wheel but I have no way of checking this].
2. A click on say a checkbox in the browser toggles the checkbox.

To eliminate these, I've installed three events on the browser,  
kEventControlClick, kEventMouseWheelMoved & kEventTrackpadScrolled.


Anyone got better ideas?

TIA
Bernie


'----------
long if 0
"ControlEventHandler"
enterproc fn ControlEventHandler( nextHandler as EventHandlerCallRef, ¬
             theEvent as EventRef, userData as pointer ) = OSStatus
'~'1
dim as HIViewID     cID
dim as HiViewRef  @ c
dim as WindowRef  @ w
dim as long         result
dim as OSStatus     ignore

result = _eventNotHandledErr

select fn GetEventClass( theEvent )
case _kEventClassControl
select fn GetEventKind( theEvent )
case _kEventControlClick
ignore = fn GetEventParameter( theEvent, _kEventParamWindowRef, ¬
              _typeWindowRef, #0, sizeof( WindowRef ), #0, @w )
ignore = fn GetEventParameter( theEvent, _kEventParamDirectObject, ¬
               _typeControlRef, #0, sizeof( ControlRef ), #0, @c )
long if ( w == fn GetUserFocusWindow() )
long if ( fn HIViewGetID( c, @cID ) == _noErr )
select cID.id
case _cBrowser1
case _cBrowser2
end select
end if
xelse
SelectWindow( w )
result = _noErr
end if
end select

case _kEventClassMouse
ignore = fn GetEventParameter( theEvent, _kEventParamWindowRef, ¬
               _typeWindowRef, #0, sizeof( WindowRef ), #0, @w )
select fn GetEventKind( theEvent )
case _kEventMouseWheelMoved, _kEventTrackpadScrolled// N.B.  
_kEventTrackpadScrolled = _kEventMouseWheelMoved + 1
if ( w != fn GetUserFocusWindow() ) then result = _noErr// don't scroll
end select
end select
exitproc = result
end If
'----------