Yes,

enEventClasses  is an enum so I am just casting it to an UInt32,
as per the Xcode Reference:

struct EventTypeSpec {
   UInt32 eventClass;
   UInt32 eventKind;
};
typedef struct EventTypeSpec EventTypeSpec;


Heres one strange thing though - actually I found out yesterday that by
forgetting to include Byref , for the version of the project that WORKS, the
structure holding the array of eventtypespecs isnt actually being filled. If
I actually fill the structure I get a crash. A mystery - passing a non zero
eventcount along with an empty event struct works fine in the Carbon
version.

On 3/5/07 02:59, "Charles Yeomans" <[EMAIL PROTECTED]> wrote:

> Is UInt32(*) a cast?  eventClass is an OSType; what is
> enEventClasses.kEventClassWindow?
> 
> Charles Yeomans
> 
> 
> On May 2, 2007, at 6:03 PM, Daniel Stenning wrote:
> 
>> 
>> These:
>> 
>> 
>>   evTypes.Type(0).eventClass = UInt32
>> (enEventClasses.kEventClassWindow)
>>   evTypes.Type(0).eventKind = UInt32(kEventWindowClose)
>> 
>>   evTypes.Type(1).eventClass = UInt32(enEventClasses.kEventClassMouse)
>>   evTypes.Type(1).eventKind = UInt32(kEventMouseDown)
>> 
>>   evTypes.Type(2).eventClass = UInt32(enEventClasses.kEventClassMouse)
>>   evTypes.Type(2).eventKind = UInt32(kEventMouseDragged)
>> 
>>   evTypes.Type(3).eventClass = UInt32
>> (enEventClasses.kEventClassWindow)
>>   evTypes.Type(3).eventKind = UInt32(kEventWindowDrawContent)
>> 
>>   evTypes.Type(4).eventClass = UInt32
>> (enEventClasses.kEventClassWindow)
>>   evTypes.Type(4).eventKind = UInt32(kEventWindowResizeCompleted)
>> 
>>   evTypes.Type(5).eventClass = UInt32
>> (enEventClasses.kEventClassWindow)
>>   evTypes.Type(5).eventKind = UInt32(kEventWindowDragCompleted)
>> 
>>   evTypes.Type(6).eventClass = UInt32
>> (enEventClasses.kEventClassWindow)
>>   evTypes.Type(6).eventKind = UInt32(kEventWindowUpdate)
>> 
>> 
>> Regards,
>> 
>> Dan
>> 
>> On 2/5/07 18:20, "Charles Yeomans" <[EMAIL PROTECTED]> wrote:
>> 
>>> For which events are you registering?
>>> 
>>> Charles Yeomans
>>> 
>>> 
>>> 
>>> On May 2, 2007, at 1:15 PM, Daniel Stenning wrote:
>>> 
>>>> On 2/5/07 17:58, "Charles Yeomans" <[EMAIL PROTECTED]> wrote:
>>>> 
>>>>> Offhand, I'm not sure that the code below would work.  For example,
>>>>> you appear to be passing a nil Ptr as the last parameter to
>>>>> InstallEventHandler.
>>>> 
>>>> The carbon library declaration for the last parameter is ByRef so
>>>> InstallEventHandler sets the pointer by reference.
>>>> 
>>>>> I assume that CEventTypes is a struct,
>>>> Correct
>>>> 
>>>>> but I'm   not sure how that works, since you should be passing an
>>>>> array of
>>>>> event types.
>>>> 
>>>> It is a struct with a fixed number of eventtype elements ( I
>>>> realise I could
>>>> have done this through a memoryblock but it seemed easier just to
>>>> use a
>>>> struct holding a fixed array.
>>>> 
>>>> 
>>>>> Does InstallEventHandler always return 0?
>>>> 
>>>> Yes.
>>>>> 
>>>>> Charles Yeomans
>>>>> 
>>>>> 
>>>>> On May 2, 2007, at 12:45 PM, Daniel Stenning wrote:
>>>>> 
>>>>>> 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:
>>>>>> 
>>>>>> <snick>
>>>>>> //-----------------
>>>>>> 
>>>>>> 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>
> 

Regards,

Dan



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to