From: Daan L. <daa...@xs...> - 2003-08-17 15:03:15
|
Hi Brandon, > I'm writing a program that would like to display derivation > trees for simple proofs. I'm representing derivations as a > tree structure where the nodes are labeled with the result > and the rule used. Thanks for trying wxHaskell! > I have a function produces a tree from a derivation and a > parent, returning a panel with the conclusion, a horizonal > line (of the right width, using bestSize on the staticTest), > and a row of panels containing the subderivations. How > expensive are panels? Should I avoid deeply nested containers? Hmm, in general, using layout is not very expensive and you can surely use deeply nested containers. However, a "panel" is not like a Java panel. A wxWindows panel is in essence only used to manage keyboard navigation among controls in a dialog. As such, you don't need to use a panel to manage your subtrees but you can use layout directly. Regarding your application, I would say that you are probably better off by drawing your derivation tree explicitly using an "on paint" event handler on a scrollable window. You will see that it is not so hard to write an algorithm that assigns locations to the nodes of your tree. After that, it is easy to draw them nicely on the DC. Using the same tree, that is attributed with locations, you can install an "on rightClick" event handler that checks which node is clicked and pop up a context menu with options for the user. (In general you should use the "on context" handler but unfortunately I made a little mistake in the type signature and forgot to pass the mouse position too, so you need to work around it using "on right click") > So far so good, but I would like to be able to change the > proof being displayed. I assume I could construct a new panel > from the new proof, and set the layout of my main window to a > new layout that doesn't mention the old panel, but I'm > worried that this leaks widgets. Does it? Does it leak widgets? In general, I have noticed that wxWindows seldom leaks. However, you never know if you can't check it :-) If you work on windows, and if you can use Visual C++ 6.0, you can build a debug version of the wxc library that will tell you if the program leaks or not. Let me know if you work on windows, maybe I'll put a debug version on the web. Hope this helps, All the best, Daan. > Do I need to make > an explicit call to a "destroy this widget" function, or a > "remove this child" function? > > On the subject of leaks, wxHaskell wasn't build with ghci > libraries, or with profiling libraries. Are there any deep > reasons for this? Did I just miss the right configure options? > > This looks like a great library, I'm just clueless. Thanks > for building this. > > Brandon > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites > including Data Reports, E-commerce, Portals, and Forums are > available now. Download today and enter to win an XBOX or > Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet _072303_01/01 _______________________________________________ wxhaskell-users mailing list wxh...@li... https://lists.sourceforge.net/lists/listinfo/wxhaskell-users |