[GUI] wxWindows
Daan Leijen
daanleijen@xs4all.nl
Wed, 12 Feb 2003 20:38:45 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0028_01C2D2D6.BD35F720
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi All,
> --- Krasimir Angelov wrote:
>
> Maybe the wxWindows backed will be good starting=20
> point for the first working prototype. I still prefer
> native WIN32 and GTK backends but this is just my own
> preference.=20
To help this discussion, I have put the haddock generated
interface of the core wxHaskell binding on the web, so everyone
can see how it looks like.=20
http://wxhaskell.sourceforge.net/doc/wxh
Some html files are about 3mb in size, so it can take a while
to download.
(and yes, it is on sourceforge but I wouldn't recommend anyone
to try to build it yet as everything is still very initial).
All the best,
Daan.
----------- and the bye-demo again ----------------
{------------------------------------------------------------------------=
--------This program implements the "goodbye" demo as posted by John =
Meacham onthe Haskell GUI mailing list. The program is specified as:I =
propose a simple program which pops up a window saying 'Hello World' =
with a button saying 'Bye' which you click and it changes the message to =
'Goodbye'. if you click the button again the program exits.When the =
button is clicked the first time, it calls "onCommand1". This function =
changes the text of the label and installs another event handler on the =
button that closes the main frame. (by default, wxWindows exits the gui =
when all windows are =
closed).-----------------------------------------------------------------=
---------------}module ByeDemo whereimport Graphics.UI.WXHmain :: IO =
()main =3D run guigui :: IO ()gui =3D do -- create top frame f =
<- frameCreateTopFrame "Bye demo" f # windowSetBackgroundColour =
white -- create text and button control t <- =
staticTextCreate f idDefault "Hello World" rectNull 0 b <- =
buttonCreate f idDefault "Bye" rectNull 0 -- put the button =
underneath the text tsize <- t # windowGetSize b # =
windowMove (pt 0 (sh tsize)) -- resize the frame around the =
controls bsize <- b # windowGetSize f # windowSetClientSize =
(sz (max (sw tsize) (sw bsize)) (sh tsize + sh bsize)) -- set =
command handler on the button b # buttonOnCommand (onCommand1 f t =
b) -- show the frame f # windowShow f # windowRaise =
return () where -- call on the first click onCommand1 f t b =
=3D do t # controlSetLabel "Goodbye!" b # buttonOnCommand =
(onCommand2 f) return () -- call on the second click =
onCommand2 f =3D do f # windowClose False return ()
------=_NextPart_000_0028_01C2D2D6.BD35F720
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi All,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>> --- Krasimir Angelov =
wrote:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>> Maybe the wxWindows backed will be =
good=20
starting <BR>> point for the first working prototype. I still =
prefer<BR>>=20
native WIN32 and GTK backends but this is just my own<BR>> =
preference.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>To help this discussion, I have put the =
haddock=20
generated</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>interface of the core wxHaskell binding =
on the web,=20
so everyone</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>can see how it looks like. =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><A href=3D"http://wxhaskell.sourceforge.net/doc/wxh"><FONT =
face=3DArial=20
size=3D2>http://wxhaskell.sourceforge.net/doc/wxh</FONT></A></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Some html files are about 3mb in size, =
so it can=20
take a while</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>to download.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>(and yes, it is on sourceforge but I =
wouldn't=20
recommend anyone</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>to try to build it yet as everything is =
still very=20
initial).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>All the best,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Daan.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>----------- and the bye-demo again =
----------------</FONT></DIV><PRE>{--------------------------------------=
------------------------------------------<BR>This program implements =
the "goodbye" demo as posted by John Meacham on<BR>the Haskell GUI =
mailing list. The program is specified as:</PRE><PRE>I propose a simple =
program which pops up a window saying 'Hello World' <BR>with a button =
saying 'Bye' which you click and it changes the message <BR>to =
'Goodbye'. if you click the button again the program =
exits.</PRE><PRE>When the button is clicked the first time, it calls =
"onCommand1". This function <BR>changes the text of the label and =
installs another event handler on the button <BR>that closes the main =
frame. (by default, wxWindows exits the gui when all <BR>windows are =
closed).<BR>-------------------------------------------------------------=
-------------------}<BR>module ByeDemo where</PRE><PRE>import =
Graphics.UI.WXH</PRE><PRE>main :: IO ()<BR>main <BR> =3D run =
gui</PRE><PRE>gui :: IO ()<BR>gui<BR> =3D do -- create top =
frame<BR> f <- =
frameCreateTopFrame "Bye demo" <BR> =
f # windowSetBackgroundColour =
white</PRE><PRE> -- create text and =
button control<BR> t <- =
staticTextCreate f idDefault "Hello World" rectNull =
0<BR> b <- buttonCreate f =
idDefault "Bye" rectNull 0<BR> =
<BR> -- put the button underneath =
the text<BR> tsize <- t # =
windowGetSize<BR> b # windowMove (pt =
0 (sh tsize))</PRE><PRE> -- resize =
the frame around the controls<BR> =
bsize <- b # windowGetSize<BR> f =
# windowSetClientSize (sz (max (sw tsize) (sw bsize)) (sh tsize + sh =
bsize)) </PRE><PRE> -- set command =
handler on the button<BR> b # =
buttonOnCommand (onCommand1 f t =
b)</PRE><PRE> -- show the =
frame<BR> f # windowShow =
<BR> f # windowRaise =
<BR> return ()<BR> =
where<BR> -- call on the first =
click<BR> onCommand1 f t =
b<BR> =3D do t # controlSetLabel =
"Goodbye!"<BR>  =
; b # buttonOnCommand (onCommand2 =
f)<BR> =
return ()</PRE><PRE> -- call on the second =
click<BR> onCommand2 =
f<BR> =3D do f # windowClose =
False<BR> =
return ()<BR> =
<BR></PRE></BODY></HTML>
------=_NextPart_000_0028_01C2D2D6.BD35F720--