Hi David, No-one else has answered, so I will do my best for you...
On Thu, 14 Jan 2010 13:15 +1300, "David Streader" <d...@cs.waikato.ac.nz> wrote: > So *Question one*: What is the best source of documentation? > An example - I have successfully used grids to generate layout for a > frame/ dialog. But I need to know the name of a grid so that I can > later set some of its attributes (add rows cols, ....). The only > commands I have found (in example code) to do this are Documentation and its layout are not always as clear as they could be for wxHaskell. Despite the fact that it is not the most 'interesting' or 'fun' thing for me to work on, I plan to do quite a bit of work on this in the coming weeks. Some will reflect itself in updated documentation in the source code and other aspects will probably turn into blog (http://wewantarock.wordpress.com) articles. The first thing to realize is that there are really three parts to wxHaskell: 1) The wrappings over the wxWidgets library. These are essentially C versions of wxWidgets C++ APIs, and they are mainly auto-generated from C code. The wrappings are almost undocumented beyond their types, and are mainly in the Graphics.UI.WXCore.Wxc**** hierarchy. I recommend using the wxWidgets documentation to find out more about these - it is generally pretty straightforward to work out what wxWidgets class and function is involved, and it is often particularly useful to look up functions in WxcClassesAL and WxcClassesMZ, which covers most of the lowest level wrapping. 2) Low level bindings over the library wrapper (rest of WXCore) - these are sparsely, but generally adequately documented 3) Higher-level (i.e. more declarative) functionality in Graphics.UI.WX - again, sparsely but adequately documented. > g <- gridCreate parent id rect flags > gridCreateGrid g 0 0 0 > > But I have failed to find and documentation for gridCreate or > gridCreateGrid where should I look. For this specific example, look in the documentation for Graphics.UI.WXCore.WxcClassesAL for 'Grid'. This lists a considerable number (I didn't count, but it must be around 100) of functions, including gridCreate and gridCreateGrid. The documentation you will see is extremely brief. It says: gridCreate :: Window a -> Id -> Rect -> Style -> IO (Grid ()) usage: (gridCreate prt id lfttopwdthgt stl) gridCreateGrid :: Grid a -> Int -> Int -> Int -> IO () usage: (gridCreateGrid obj rows cols selmode) To understand what these *really* do, we need to go look at the wxWidgets documentation, which in this case is at http://docs.wxwidgets.org/stable/wx_wxgrid.html#wxgrid. To really interpret what the functions do, you need to find the appropriate method names. One rule you need to know is that <widgetname>Create is a wrapper for the C++ constructor - in other words, we should look at wxGrid() to find out what gridCreate does. Things get a bit more complicated for overloaded constructors and methods, but it's usually not too hard to work out. So, finally, for your examples above: gridCreate is a wrapper for wxGrid::wxGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxPanelNameStr) "Constructor to create a grid object. Call either wxGrid::CreateGrid or wxGrid::SetTable directly after this to initialize the grid before using it." gridCreateGrid is a wrapper for wxGrid::CreateGrid(int numRows, int numCols, wxGrid::wxGridSelectionModes selmode = wxGrid::wxGridSelectCells) "Creates a grid with the specified initial number of rows and columns. Call this directly after the grid constructor. When you use this function wxGrid will create and manage a simple table of string values for you. All of the grid data will be stored in memory. For applications with more complex data types or relationships, or for dealing with very large datasets, you should derive your own grid table class and pass a table object to the grid with wxGrid::SetTable." The bad (and not really satisfactory, from a Haskell perspective) aspect of this is that you really need to have at least a limited ability to read C++ to understand this. > *Question two*: Would it be better to use the wxWidgets documentation? > if so is there any documented way to translate wxWidgets method calls > into Haskell? Hopefully the example above covers this sufficiently? I hope that documentation will be an aspect of wxHaskell which improves significantly in the near future. Best regards Jeremy -- Jeremy O'Donoghue jeremy.odonog...@gmail.com ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users