Difference between revisions of "WxHaskell"

From HaskellWiki
Jump to navigation Jump to search
Line 28: Line 28:
 
** [http://wxhaskell.sourceforge.net/samples.html samples]
 
** [http://wxhaskell.sourceforge.net/samples.html samples]
 
** [http://wxhaskell.sourceforge.net/applications.html applications]
 
** [http://wxhaskell.sourceforge.net/applications.html applications]
* [[WxHaskell/Documentation|documentation]]
+
* [[/Documentation/]]
** [[WxHaskell/License|license]]
+
** [[/License/]
** [[WxHaskell/Quickstart|quick start]]
+
** [[/Quick start/]]
** [[WxHaskell/FAQ|faq]]
+
** [[/FAQ/]]
  +
** [[/Short guide]] to widgets, layout and events
* [[WxHaskell/Download|download]]
 
 
** [[/Tips and tricks/]]
*[[WxHaskell/Building|building]]
 
 
* [[/Download/]]
** [[WxHaskell/Building_on_Cygwin|cygwin]]
 
 
*[[/Building/]]
** [[WxHaskell/Building_on_Windows|msc]]
 
** [[WxHaskell/Building_on_MacOS_X|macosx]]
+
** [[/Building_on_Cygwin|cygwin]]
 
** [[/Building_on_Windows|msc]]
*[[WxHaskell/Development|development]]
 
  +
** [[/Building_on_MacOS_X|macosx]]
*[[WxHaskell/Contribute|contribute]]
 
 
*[[/Development/]]
 
*[[/Contribute/]]
   
 
== Installation ==
 
== Installation ==
Line 44: Line 46:
 
The [[WxHaskell/Install | wxHaskell install]] page contains details of different people's experience in compiling and installing wxHaskell against various versions of wxWidgets on various platforms.
 
The [[WxHaskell/Install | wxHaskell install]] page contains details of different people's experience in compiling and installing wxHaskell against various versions of wxWidgets on various platforms.
   
== Tips and tricks ==
 
 
# Getting Started:
 
#* read carefully http://wxhaskell.sourceforge.net/quickstart.html - it contains more information than you think
 
#* we include below some orientation for the most essential wxhaskell concepts
 
#* see samples/wx/Minimal.hs
 
# Text:
 
#* retrieving the text of a TextCtrl: mytext <- get mytextEntry text
 
#* staticText misbehaves on resize: make sure that you are giving the widget enough space... for example, if you want a one-line staticText, you should
 
#** use hfill on the staticText
 
#** '''not''' use hfill (or hfloat...) or any other widgets in the same row
 
# [[WxHaskell/Layout | Layout]]:
 
#* Don't bother looking at the the examples yet, the API is better for this
 
#* See the Haddock-generated documentation for Graphics.UI.WX.Layout
 
#* Got layout troubles? Packing things inside yet another panel seems to help sometimes
 
# Scroll Bars:
 
#* scrollbars are just windows. You create a scrollFrame, and any widgets you want inside the scrollbars, you make this scrollFrame their parent
 
#* see samples/wx/ImageViewer.hs
 
#* the following widgets (controls) already include scrollbars : listBox
 
# Mac OS X (Darwin)
 
#* for ghci usage download EnableGui.hs from wxhaskell.sourceforge.net/download/EnableGUI.hs and <br /><code> ghc -fffi -package wx EnableGUI.hs<br /> ghci -package wx HelloTest.hs EnableGui.hs<br />-- followed by :m +EnableGUI and <br />enableGUI >> main</code>
 
 
=== Other tips ===
 
 
==== Idle event ====
 
 
Use the [[WxHaskell/Idle event | idle event]] for automation.
 
 
=== Long computations ===
 
 
Scenario: you've got a looooooong computation and you want to update a progress bar or you want to have a 'STOP' button which aborts the computation
 
 
Solution:
 
* wxcApp(Safe)Yield
 
 
''FIXME: elaborate on this!''
 
 
=== Managing multiple windows ===
 
 
Scenario: you have a main window MAIN with some information. You want to create a secondary window PARAMS in which the user edits some configuration stuff. When the user closes PARAMS, the window MAIN should be updated to reflect the new settings.
 
 
You have some code which looks like
 
 
set paramsButton [ on command := do createParamsWindow
 
updateMainWindow ]
 
 
Problem: MAIN is not updated... at least, not until you call PARAMS a second time.
 
 
Observations:
 
* This is NOT a problem with Haskell laziness
 
 
Explanation:
 
updateMainWindow tries to read the new configuration value, but it does not succeed, because no configuration values have changed. Why not? Simpler than it looks: all the createParamsWindow function does is creates a window with some widgets, assign some commands to said widgets, and return. There's nothing in the createParamsWindow code that says the function should only return when PARAMS has been closed.
 
 
Solution:
 
Pass createParamsWindow a function which updates the MAIN window:
 
 
set paramsButton [ on command := do createParamsWindow updateMainWindow ]
 
 
When the user closes PARAMS, one of the final things it should do is call this update function
 
   
 
== External links ==
 
== External links ==

Revision as of 18:34, 5 August 2008


Wxhaskell-black-small.png

What is it?

wxHaskell is a portable and native GUI library for Haskell. The goal of the project is to provide an industrial strength GUI library for Haskell, but without the burden of developing (and maintaining) one ourselves.

wxHaskell is therefore built on top of wxWidgets – a comprehensive C++ library that is portable across all major GUI platforms; including GTK, Windows, X11, and MacOS X. Furthermore, it is a mature library (in development since 1992) that supports a wide range of widgets with the native look-and-feel, and it has a very active community (ranked among the top 25 most active projects on sourceforge).

Status

Since the core interface is generated automatically from the wxEiffel binding, about 90% of the wxWidgets functionality is already supported, excluding more "exotic" widgets like dockable windows. Most work is currently directed into writing a Haskellized version of the wxWidgets API. The library currently supports Windows, GTK (Linux) and MacOS X.


News

23 March 2008
wxHaskell 0.10.3 is released.
20 January 2007
wxHaskell has a new set of maintainers, led by Jeremy O'Donoghue. We are working on a release for version 0.10, with Uni code support, a Cabalized build process and more. All recent development is taking place under a new darcs repository (darcs get http://darcs.haskell.org/wxhaskell).

Documentation

Installation

The wxHaskell install page contains details of different people's experience in compiling and installing wxHaskell against various versions of wxWidgets on various platforms.


External links

See also