From: Daan L. <t-...@mi...> - 2005-07-20 18:48:19
|
Hi Surendra, > Hello, > We(wxCL project) are trying to use wxC to write Common lisp ffi > bindings for > wxWidgets. We are just starting and I have few basic questions about wxC. Very nice idea. I think the start will be a bit hard but it is worth it -- once it works you'll get a lot of leverage out of wxWidgets. > If I want to use wxC API's to create GUI frames, and stuff, if I > understand correctly > than first I need to initialize everything by calling > ELJApp_initialize function. But this function calls wxEntry, and because > in the call > to wxEntry the fifth argument is not present, and so wxWidget goes into an > event > handling loop, and the function call never returns. The lisp > implementation which I > am using is single threaded, so how do I avoid this problem, or should I > call some > other function. First, make sure you have the right wxc tree: the one underneath "/wxhaskell/wxc" (not "/wxc"). The function to call is "ELJAPP_initializeC" (not "ELJAPP_initialize"). This function expects a "wxClosure" as an argument. These "wxClosure"'s are the way to connect Common Lisp to the wx world. WxWidget events will call back on wxClosure's into the Lisp world. You create a closure using "wxClosureCreate( ClosureFun fun, void* data )" (see "wxc/src/wrapper.cpp"). A ClosureFun is=20 typedef void _cdecl (*ClosureFun)( void* _fun, void* _data, void* _evt ); (see "wxc/src/wrapper.h"). This means that the function you pass to wxClosure create gets called with the function pointer itself, the associated data pointer, and the wxEvent object. You can register for event handlers by calling "wxEvtHandlerConnect". When an object is destroyed, it calls on its listening wxClosures with a NULL event object. This also happens for the closure that you pass to "ELJAPP_initializeC" -- ie. you would call the initalize function with a closure this is only fired once with a NULL event -- and you use this to run the LISP initialization that will create windows etc. and install further event handlers on the frames. This means that you hand over control to wxWidgets -- only being in LISP land when an event is triggered. See also "wxcore/src/graphics/ui/wxcore/Events.hs" -- at the bottom there is all the Haskell magic to connect event handlers -- see also "appInit" there. >=20 > Also if I try to use the bitmap functions, then do I need to initialize > anything? > I tried opening png/gif files using bitmap functions (without initializin > anything), > but the function was returning me a 0 value(indicating failure). Do I need > to have > png/gif dlls for things to work, or was it failing because wxC was not > initialized. Most image files are opened directly, but some need registration. Normally this is called on ELJApp::OnInit (see "wxc/src/wrapper.cpp") which is called from "ELJAPP_initializeC". You could initialize manually though. > Note: I was linking to the dll distributed with window distribution of > wxHaskell. >=20 > I am new to haskell and would like to try wxHaskell, does it works on > Hugs, or is GHC > the only interpreter it supports? No, only works with GHC. (but technically it could run on Hugs too) =20 > It will be nice if the mailing list can be archived on Gmane, this will > make it much > easier to read and search old mail archives. I have no idea what Gmane is :-) Please inform me offline about how to do such thing. All the best, -- Daan Leijen. >=20 > Thanks for your time. > Sincerely, > -- > Surendra Singhi >=20 > http://www.public.asu.edu/~sksinghi/index.htm >=20 >=20 > __________________________________________________________________ > Switch to Netscape Internet Service. > As low as $9.95 a month -- Sign up today at > http://isp.netscape.com/register >=20 > Netscape. Just the Net You Need. >=20 > New! Netscape Toolbar for Internet Explorer > Search from anywhere on the Web and block those annoying pop-ups. > Download now at http://channels.netscape.com/ns/search/install.jsp >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. = http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclick > _______________________________________________ > wxhaskell-users mailing list > wxh...@li... > https://lists.sourceforge.net/lists/listinfo/wxhaskell-users |