From: Axel S. <A....@ke...> - 2007-07-13 14:42:55
|
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. >> > |