Prev | Current Page 948 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


When creating a hook to a specific event type, one must know the actual numeric constant value
associated with the event in the operating system ??“ specific C or C++ libraries. This information can be
found by browsing the library header files or by performing a quick search in google for C - based event
constants that are prepended with the characters WM_ . Once this information is known, you can then
proceed to acquire a hook into the events messaging loop using the addMessageHook method of the
Window class:
var hook : swhx.MessageHook = window.addMessageHook( intEventID );
Chapter 18: Desktop Flash with SWHX
517
The returned hook value can then be used to assign a Neko function for handling the event:
hook.setNekoCallback( evtCallback );
The hook value can also be used within the callback method to acquire one or both of the event
parameters, which are assigned to the MessageHook instance as the parameters p1 and p2 :
var evtCallback = function()
{
neko.Lib.print( hook.p1 + ???, ??? + hook.p2 );
}
It is worth noting at this point, although we are not sure how legitimately, that while a reference to a
static function can be passed to MessageHook.


Pages:
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960