
===================== CGA-example version 1.1 =====================
Great Stuff!
1) How does the interface look in Test_midlevel.hs? Is there any critiques in regard to using this style in CGA (Common GUI API)?
Looks nice. What I don't like: *) Why is toWidget in the IO monad? Instead of a <- toWidget hello set window [ children =: [a], visible =: True ] I'd rather write set window [ children =: [toWidget hello], visible =: True ] *) No dynamic layout yet. If we have a container that does dynamic layout similar to Java's GridBagLayout, then of course we don't want to set size and position attributes for each widget. We'd set row, column, row span and column span attributes instead. Those layout constraints are not really attributes of the widget itself. Rather, they should perhaps be passed along with addChild. But right now I can't think of how to do it without multi-parameter type classes (we wanted to stick to H98, didn't we?): class HasAddChild a c where addChild :: IsWidget b => a -> b -> c -> IO () class HasChildren w c where children :: Attr w [(Widget,c)] ... where c would be a set of coordinates, or a set of row & column numbers, depending on what kind of container we are in. In a container with dynamic layout, position and size would still make sense as a read-only attribute, but explicitly setting the position would be questionable.
4) What do you think is important to have in the next version of CGA-example?
Some framework for dynamic layout, see above.
I encourage those who code, to implement their ideas for the Common GUI API using this simple framework. This would allow all reviewers to understand exactly what you are talking about by running your examples.
I've already started compiling fltk... Cheers, Wolfgang