Re: [wxhaskell-users] virtual list control
Hi Jeremy, I don't know if you continued working on this, but I forked wxHaskell on GitHub and tried to implement it myself: https://github.com/FabianBinz/wxHaskell For testing purposes, I only implemented the OnGetItemText and SetItemCount method and it seems to work. To implement the virtual list control, I defined a new class wxVirtualListCtrl in wxc: https://github.com/FabianBinz/wxHaskell/blob/master/wxc/src/include/virtuall istctrl_impl.h Since it needs to invoke a callback function, I created the typedef OnGetItemTextCallback. To make wxdirect accept this new type, I extended the parser (patomtype) in ParseC.hs. This solution is very ad-hoc and I think because wxc is supposed to be a language agnostic C wrapper, we should maybe add another macro to wcx_types.hs (something like TCallback), which is then recognized by wxdirect. So, while this all works pretty well, there is unfortunately a memory leak in Graphics.UI.WXCore.VirtualListCtrl, because of my use of newCString. At the moment I don't know how to fix it and would be glad if someone could give me some advice. Regards, Fabian -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
Re: [wxhaskell-users] virtual list control
Hi Fabian, On 12 May 2012 16:12, Fabian Binz fabianb...@yahoo.de wrote: Hi Jeremy, I don't know if you continued working on this, but I forked wxHaskell on GitHub and tried to implement it myself: https://github.com/FabianBinz/wxHaskell I have been doing some work, but I don't have a lot of time right now, so it is going more slowly than I would like. For testing purposes, I only implemented the OnGetItemText and SetItemCount method and it seems to work. To implement the virtual list control, I defined a new class wxVirtualListCtrl in wxc: https://github.com/FabianBinz/wxHaskell/blob/master/wxc/src/include/virtuallistctrl_impl.h Since it needs to invoke a callback function, I created the typedef OnGetItemTextCallback. To make wxdirect accept this new type, I extended the parser (patomtype) in ParseC.hs. This solution is very ad-hoc and I think because wxc is supposed to be a language agnostic C wrapper, we should maybe add another macro to wcx_types.hs (something like TCallback), which is then recognized by wxdirect. So, while this all works pretty well, there is unfortunately a memory leak in Graphics.UI.WXCore.VirtualListCtrl, because of my use of newCString. At the moment I don't know how to fix it and would be glad if someone could give me some advice. You need to use a finalizer - this is what I am looking into. There is an overview at http://www.haskell.org/haskellwiki/GHC/Using_the_FFI#Calling_Haskell_from_C, but it could be clearer! Basic idea is that you free the CString when the GC has no more references to the closure in which it is used. I am using the event handler code as a model, since this already allows callbacks from C to Haskell, and handles reference counting. Just haven't finished yet. I will take a look at your fork and see if you are further along than me, and take code accordingly. Best regards Jeremy -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
Re: [wxhaskell-users] virtual list control
Hi Fabian On 15 April 2012 21:40, Jeremy O'Donoghue jer...@o-donoghue.com wrote: They could be added easily. I'll take a look. On 15/04/2012 12:16, Fabian Binz fabianb...@yahoo.de wrote: Hello, ** ** I need to display a quite large number of data in a list control and use the ‘items’ attribute for that purpose. However, I’m not content with the speed of this solution andwould like to use a ‘virtual’ list control instead, as it is described here: [1] ** ** The problem is, that the necessary constants and functions (i.e. wxLC_VIRTUAL) are not defined by wxHaskell. Is there a technical reason for this or could they be added easily? I have just pushed experimental support for virtual list controls to the GitHub experimental repo. You're welcome to give it a try. https://github.com/jodonoghue/wxHaskell/commit/b5d1029b272460d729950d751d90da76df56b5dc Added methods: listCtrlGetItemFont, listCtrlIsVirtual, listCtrlRefreshItem, listCtrlRefreshItems. Added constants: wxLC_VIRTUAL, wxLC_MASK_TYPE, wxLC_MASK_ALIGN, wxLC_MASK_SORT. Removed deprecated constant wxLC_USER_TEXT. I'll be pushing the work which I've pushed over the last week or so to the Darcs repo next week, and will make a release to Hackage once I have had a chance to test on all platforms (I've only verified on Mac for the moment. Best regards Jeremy -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2___ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users
Re: [wxhaskell-users] virtual list control
They could be added easily. I'll take a look. On 15/04/2012 12:16, Fabian Binz fabianb...@yahoo.de wrote: Hello, I need to display a quite large number of data in a list control and use the items¹ attribute for that purpose. However, I¹m not content with the speed of this solution and would like to use a virtual¹ list control instead, as it is described here: [1] The problem is, that the necessary constants and functions (i.e. wxLC_VIRTUAL) are not defined by wxHaskell. Is there a technical reason for this or could they be added easily? Regards, Fabian [1]: http://docs.wxwidgets.org/trunk/classwx_list_ctrl.html http://docs.wxwidgets.org/trunk/classwx_list_ctrl.html -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2_ __ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users -- Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev___ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users