Prev | Current Page 923 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

call.windowNew( [TOPLEVEL] );
var func = function( event : Dynamic )
{
neko.Lib.println( ???sender : ??? + event.sender );
var types : Array < Dynamic > = untyped Array.new1( event.sig_types,
__dollar__asize( event.sig_types ) );
var values : Array < Dynamic > = untyped Array.new1( event.sig_prms,
__dollar__asize( event.sig_prms ) );
for ( i in 0...types.length )
neko.Lib.println( ???parameter ??? + types[i] + ??? = ??? + values[i] );
}
var button = Gtk.call.ButtonNewWithLabel( [neko.Lib.haxeToNeko( ???Button??? )] );
Gtk.call.containerAdd( [win, button] );
Gtk.call.widgetShow( [button] );
signal( button, neko.Lib.haxeToNeko( ???clicked??? ), func, this );
Gtk.call.windowSetTitle( [win, ???Basic Example???] );
Gtk.call.widgetShow( [win] );
Gtk.run();
}
}
As you can see, the signal function that handles the event handling assignment derives from
hxs_closure_connect from the hxGtk ndll . This function call requires four parameters. The first of
these is the GTK object, or widget if you like, that will fire the event, the second parameter is a Neko
string detailing the type of event to register, while the other two required parameters include the
function to call when the event is raised, and an object that will simply be carried over, within the event
object, to the events function.


Pages:
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935