From: Axel S. <A....@ke...> - 2007-07-16 10:56:24
|
Adde, On Jul 16, 2007, at 1:10, Adde wrote: > Hi again. > Speaking of segfaults, just got an exception > ('gtk2hs_store_iter_n_children_impl: uncaught exception') for calling > 'treeModelIterNChildren store Nothing' on an empty (no items) > TreeStore. > The code runs if I add items to the store before showing the window. > Any ideas? Not really. Do you: - use ListStore - if yes, which ghc version are you using? - use TreeStore Thanks, Axel. P.S.: please reply to the mailing list, so other people we can keep track of things (and so we people can google for problems). > /Adde > > On Fri, 2007-07-13 at 15:41 +0100, Axel Simon wrote: >> On Jul 13, 2007, at 15:28, Adde wrote: >> >>> Ok, thanks! >>> I'll just have to use my own function (myWindowShow) for now. >>> >>> The reason I tried is that I couldn't find anything in the >>> WindowClass >>> documentation about these tricks. Making something an instance of >>> WindowClass works, but as you said, there are no methods to >>> implement >>> and it segfaults when you try to use your data as a Window. >> >> Hm, maybe we need to do something so that we don't actually export >> the classes. One key feature Gtk2Hs should have is that you cannot >> make it segfault. >> >>> Do you mind if I sneak by another question while we're at it? >>> I'm trying to iterate through a TreeStore while modifying the >>> objects it >>> contains. The ModelView documentation says I should use >>> TreeRowReferences but I can't figure out how to call >>> treeRowReferenceNew. It wants a NativeTreePath and all I've got is >>> regular TreePaths (via treeModelGetPath). >>> I got it to work by saving the TreePaths instead but as I >>> understand it >>> they can't be used after inserting / deleting. >> >> Ops. I guess that's unfinished. Which reminds me that I should push >> the changes that I have in my local repository. I can probably fix >> the row reference thing. >> >> TreePaths are simple lists of integers. The problem is that if you >> have a reference like [0,1,2] and you insert a node at the same >> location, the previous node now will have the index [0,1,3]. In >> contrast, RowReferences continue to point to that row, no matter how >> many nodes are inserted or deleted. >> >>> Thanks for a great library, I had almost given up hope on using >>> Haskell >>> for serious desktop development. >>> >> >> I hope we iron out anything that stands in the way of good GUI >> programs written in Haskell! >> >> Axel. >>> On Fri, 2007-07-13 at 10:55 +0100, Axel Simon wrote: >>>> Hi Adde, >>>> >>>> On Jul 12, 2007, at 21:54, Adde wrote: >>>> >>>>> Hi. >>>>> I have a structure representing a special kind of window which >>>>> among >>>>> other things holds a Gtk Window. >>>>> >>>>> data MyWindow = data MyWindow {window :: Window, ...} >>>>> >>>>> Is there any way to make it behave like an ordinary Window so I >>>>> can >>>>> call >>>>> windowPresent etc. on it? I tried making it an instance of >>>>> WindowClass >>>>> hoping to be able to just override toWindow, but no luck. >>>> >>>> Duncan has pulled some nifty performance tricks such that the >>>> WindowClass and friends are all empty. Hence, there is actually no >>>> method you can override and everything is simply coerced. This >>>> prevents you from creating a new piece of data and making it an >>>> instance of WindowClass, I'm afraid. >>>> >>>> If you think your code would become much cleaner by keeping program >>>> data with a window (or any other object) you could use the function >>>> in System.Glib.GObject, look for "User-Defined Attributes". This >>>> may >>>> still involve passing around the attribute in addition to the >>>> window, >>>> though. >>>> >>>> Hope this helps, >>>> Axel. >>>> >>> >> > |