I have in fact added the carbon event handler ( I just used the same code as
used for the pure carbon version).
Here is the main code for the "RB" window version which doesn't work ( it
opens and the dylib paints the window correctly,l but the window fails to
respond to any mouse events:
Function OpenRB()
Soft Declare Function InstallEventLoopTimer Lib "Carbon" (inEventLoop as
Ptr, inFireDelay as Double, inInterval as double, inTimerProc as Ptr,
inTimerData as Ptr, ByRef outTimer as Ptr) As Integer
dim haseditor as UInt32 = plug.GetEffFlags() And
UInt32(VstAEffectFlags.effFlagsHasEditor)
if haseditor = 0 then
Message ("This plug does not have an editor!")
return false
end if
editwinRef = EditWin
dim eventHandler as Ptr = InstallCarbonEventHandler(editwinRef)
Dim eRect As Ptr = GetVSTRect() // asks the VSTplugin for its window
bounds
Message ("Open editor...")
call Plug.DispatchW ( AEffectOpcodes.effEditOpen, 0, 0,editwinRef, 0)
if eRect <> nil then
dim r as Rect = eRect.Rect
dim width as integer = eRect.Rect.right - eRect.Rect.left
dim height as integer = eRect.Rect.bottom - eRect.Rect.top
EditWin.Width = width
EditWin.Height = height
end if
dim parentwinref as WindowPtr = Messages
dim title as CFStringRef = plug.Name
EditWin.Title = title
EditWin.Show
// EventLoopTimerRef
dim err as integer = InstallEventLoopTimer (OS.GetCurrentEventLoop_ (),
kEventDurationSecond / 25.0, kEventDurationSecond / 25.0, AddressOf
idleTimerProc, plug.GetEffectPointer(), idleEventLoopTimer)
return true
End Function
//-----------------
Function InstallCarbonEventHandler( editwinRef as WindowPtr )
Soft Declare Function InstallEventHandler Lib "Carbon" (Target As Ptr,
Handler as Ptr, EventTypeCount As integer, ByRef evTypes As CEventTypes,
userData As Ptr, ByRef outHandlerRef as Ptr) As Integer
Soft Declare Function GetWindowEventTarget Lib "Carbon" (inWindow As
WindowPtr) As Ptr
dim eventHandler as Ptr
dim evTypeCount as integer = 7//SetupCarbonEventTypes(CarbonEventTypes)
dim err as integer = InstallEventHandler( GetWindowEventTarget(
editwinRef ), AddressOf windowHandler, evTypeCount, CarbonEventTypes ,
plug.GetEffectPointer() , eventHandler )
Return eventHandler
End Function
//-----------------
On 2/5/07 17:16, "Charles Yeomans" <[EMAIL PROTECTED]> wrote:
> You might try adding a Carbon event handler to the window to handle
> mouse events before the Rb code. As I recall, event handlers form a
> stack, so the last handler added gets first crack at the events for
> which it has registered. I've had mixed luck in taking control of
> mouse events in windows via declares.
>
> Charles Yeomans
>
> On May 2, 2007, at 12:11 PM, Daniel Stenning wrote:
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>