From: David S. <ds...@cs...> - 2010-01-14 02:03:39
|
So far I love wxHaskell when I stay safely within by simple understanding. But as soon as I step out side of my limited knowledge I am totally lost. 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 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. *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? Many thanks in advance david streader |
From: Henk-Jan v. T. <hj...@ch...> - 2010-01-14 23:59:57
|
On Thu, 14 Jan 2010 01:15:31 +0100, David Streader <ds...@cs...> wrote: > So far I love wxHaskell when I stay safely within by simple > understanding. > But as soon as I step out side of my limited knowledge I am totally > lost. > 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 > > 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. > > *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? wxWidgets doumentation can be useful, but wxWidgets doesn't have a simple one to one relationship with wxHaskell. The following link points to a description of wxGrid::CreateGrid: http://docs.wxwidgets.org/trunk/classwx_grid.html#0a3c0ccf91753666e40dd117ccc84637 Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://functor.bamikanarie.com http://members.chello.nl/hjgtuyl/tourdemonad.html -- |
From: Jeremy O'D. <jer...@gm...> - 2010-01-21 11:59:13
|
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" <ds...@cs...> 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 jer...@gm... |
From: Gour <go...@go...> - 2010-01-22 14:12:06
Attachments:
signature.asc
|
On Thu, 21 Jan 2010 11:59:01 +0000 >>>>>> "Jeremy" == "Jeremy O'Donoghue" wrote: Jeremy> Documentation and its layout are not always as clear as they Jeremy> could be for wxHaskell. Despite the fact that it is not the Jeremy> most 'interesting' or 'fun' thing for me to work on, I plan to Jeremy> do quite a bit of work on this in the coming weeks. Hooray! Jeremy> Some will reflect itself in updated documentation in the source Jeremy> code and other aspects will probably turn into blog Jeremy> (http://wewantarock.wordpress.com) articles. The only wxhaskell tutorials are those referenced on the wiki? Jeremy> 1) The wrappings over the wxWidgets library. These are Jeremy> essentially C versions of wxWidgets C++ APIs, It means one can practically call any low-level C-API wxwidgets function? Jeremy> 3) Higher-level (i.e. more declarative) functionality in Jeremy> Graphics.UI.WX - again, sparsely but adequately Jeremy> documented. Having some more complete/advanced tutorial would probably help to become familiar with usage of higher-level API. Jeremy> To really interpret what the functions do, you need to find the Jeremy> appropriate method names. One rule you need to know is that Jeremy> <widgetname>Create is a wrapper for the C++ constructor - in Jeremy> other words, we should look at wxGrid() to find out what Jeremy> gridCreate does. Things get a bit more complicated for Jeremy> overloaded constructors and methods, but it's usually not too Jeremy> hard to work out. Heh, the above 'rule' really helps. Is there any doc which explains those wxwidgets <---> wxhaskell mappings? Jeremy> The bad (and not really satisfactory, from a Haskell Jeremy> perspective) aspect of this is that you really need to have at Jeremy> least a limited ability to read C++ to understand this. I hope that 'limited' really means 'quite limited' in order that we can avoid jumping into C++ (I did it long ago in the era of Zortech C++ compiler, but then I was 'young' and now I'm not interested in C++ whatsoever.) Jeremy> I hope that documentation will be an aspect of wxHaskell which Jeremy> improves significantly in the near future. That would be wonderful and give us inspiration to work on enhancing wxhaskell further? Have you considered moving the project to some (other) public hosting with better bug tracker etc. ? SF is really becoming obsolete. (Although I'm darcs fan myself, I'll probably use Launchpad for other aspect of project managament - their bugtracker has decent email interface as well.) Sincerely, Gour -- Gour | Hlapicina, Croatia | GPG key: F96FF5F6 ---------------------------------------------------------------- |