[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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; --- Krasimir Angelov =
wrote:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Maybe the wxWindows backed will be =
good=20
starting <BR>&gt; point for the first working prototype. I still =
prefer<BR>&gt;=20
native WIN32 and GTK backends but this is just my own<BR>&gt; =
preference.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>All the best,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Daan.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>----------- and&nbsp;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&nbsp; <BR>&nbsp; =3D run =
gui</PRE><PRE>gui :: IO ()<BR>gui<BR>&nbsp; =3D do -- create top =
frame<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f &lt;- =
frameCreateTopFrame "Bye demo" <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
f # windowSetBackgroundColour =
white</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- create text and =
button control<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t &lt;- =
staticTextCreate f idDefault "Hello World" rectNull =
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b &lt;- buttonCreate f =
idDefault "Bye" rectNull 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- put the button underneath =
the text<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tsize &lt;- t # =
windowGetSize<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b # windowMove (pt =
0 (sh tsize))</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- resize =
the frame around the controls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
bsize &lt;- b # windowGetSize<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f =
# windowSetClientSize (sz (max (sw tsize) (sw bsize)) (sh tsize + sh =
bsize)) </PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- set command =
handler on the button<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b # =
buttonOnCommand (onCommand1 f t =
b)</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- show the =
frame<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f # windowShow =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f # windowRaise =
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ()<BR>&nbsp; =
where<BR>&nbsp;&nbsp;&nbsp; -- call on the first =
click<BR>&nbsp;&nbsp;&nbsp; onCommand1 f t =
b<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D do t # controlSetLabel =
"Goodbye!"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; b # buttonOnCommand (onCommand2 =
f)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
return ()</PRE><PRE>&nbsp;&nbsp;&nbsp; -- call on the second =
click<BR>&nbsp;&nbsp;&nbsp; onCommand2 =
f<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D do f # windowClose =
False<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
return ()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<BR></PRE></BODY></HTML>

------=_NextPart_000_0028_01C2D2D6.BD35F720--