Terminology (Re: [GUI] Re: Know you backends)
Daan Leijen
daanleijen@xs4all.nl
Fri, 31 Jan 2003 22:42:09 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0089_01C2C979.FD025710
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_008A_01C2C979.FD025710"
------=_NextPart_001_008A_01C2C979.FD025710
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
> 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.
Good plan, John!
Here is my contribution for the GIO library.
All the best,
Daan.
ps. more examples are in the cvs. (http://htoolkit.sourceforge.net)
-------------------------------------------------------------------------=
-------{-----------------------------------------------------------------=
---------------This program implements the "goodbye" demo as posted by =
John Meacham onthe Haskell GUI mailing list. Note that this demo also =
uses a nice layout: the label and button are centeredin the window with =
some padding around it. When the button is clicked thefirst time, it =
calls "bye". This function changes the text of the labeland installs =
another event handler on the button, that closes the main window.(by =
default, GIO exits the gui when all windows are =
closed).-----------------------------------------------------------------=
---------------}module Main whereimport Graphics.UI.GIOmain =3D start =
demo -- "start" initializes the GUI. demo :: IO ()demo =3D do w <- =
window [title =3D: "Bye!"] l <- label [text =3D: "Hello =
World"] w b <- button [text =3D: "Bye"] w set w =
[layout =3D: pad 10 (center l ^^^^ center b)] set b [on =
command =3D: bye w l b] where -- called on =
the first click, with the window, label, and button as arguments. =
bye w l b =3D do set l [text =3D: "Goodbye"] =
set b [on command =3D: close w]
------=_NextPart_001_008A_01C2C979.FD025710
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>> I propose a simple program which pops up a window =
saying<BR>>=20
'Hello World' with a button saying 'Bye' which you click and it =
changes<BR>>=20
the message to 'Goodbye'. if you click the button again the =
program<BR>>=20
exits.<BR><BR>Good plan, John!<BR><BR>Here is my contribution for the =
GIO=20
library.<BR><BR>All the best,<BR> Daan.<BR><BR>ps. =
more=20
examples are in the cvs. (<A=20
href=3D"http://htoolkit.sourceforge.net">http://htoolkit.sourceforge.net<=
/A>)</DIV><PRE><HR></PRE><PRE>{------------------------------------------=
--------------------------------------<BR>This program implements the =
"goodbye" demo as posted by John Meacham on<BR>the Haskell GUI mailing =
list. </PRE><PRE>Note that this demo also uses a nice layout: the label =
and button are centered<BR>in the window with some padding around it. =
When the button is clicked the<BR>first time, it calls "bye". This =
function changes the text of the label<BR>and installs another event =
handler on the button, that closes the main window.<BR>(by =
default, GIO exits the gui when all windows are =
closed).<BR>-------------------------------------------------------------=
-------------------}<BR>module Main where</PRE><PRE>import =
Graphics.UI.GIO</PRE><PRE>main =3D start demo -- =
"start" initializes the GUI.<BR> <BR>demo :: IO ()<BR>demo =3D do w =
<- window [title =3D: =
"Bye!"]<BR> l =
<- label [text =3D: "Hello World"] =
w<BR> b <- =
button [text =3D: "Bye"] =
w<BR> set w =
[layout =3D: pad 10 (center l ^^^^ center b)] =
<BR> set b [on =
command =3D: bye w l =
b]  =
; <BR> =
where<BR> -- called on the first =
click, with the window, label, and button as =
arguments.<BR> bye w l =
b<BR> =3D do set l [text =
=3D: "Goodbye"] =
<BR> &nb=
sp; set b [on command =3D: close w] </PRE></BODY></HTML>
------=_NextPart_001_008A_01C2C979.FD025710--
------=_NextPart_000_0089_01C2C979.FD025710
Content-Type: application/octet-stream;
name="ByeDemo.hs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="ByeDemo.hs"
{------------------------------------------------------------------------=
--------=0A=
This program implements the "goodbye" demo as posted by John Meacham on=0A=
the Haskell GUI mailing list. The program is specified as:=0A=
=0A=
I propose a simple program which pops up a window saying 'Hello World' =0A=
with a button saying 'Bye' which you click and it changes the message =0A=
to 'Goodbye'. if you click the button again the program exits.=0A=
=0A=
Note that this demo also uses a nice layout: the label and button are =
centered=0A=
in the window with some padding around it. When the button is clicked the=0A=
first time, it calls "bye". This function changes the text of the label=0A=
and installs another event handler on the button that closes the main =
window.=0A=
(by default, GIO exits the gui when all windows are closed).=0A=
-------------------------------------------------------------------------=
-------}=0A=
module Main where=0A=
=0A=
import Graphics.UI.GIO=0A=
=0A=
main =3D start demo -- "start" initializes the GUI.=0A=
=0A=
demo :: IO ()=0A=
demo =3D do w <- window [title =3D: "Bye!"]=0A=
l <- label [text =3D: "Hello World"] w=0A=
b <- button [text =3D: "Bye"] w=0A=
set w [layout =3D: pad 10 (center l ^^^^ center b)] =0A=
set b [on command =3D: bye w l b] =0A=
where=0A=
-- called on the first click, with the window, label, and button =
as arguments.=0A=
bye w l b=0A=
=3D do set l [text =3D: "Goodbye"] =0A=
set b [on command =3D: close w]
------=_NextPart_000_0089_01C2C979.FD025710--