diff options
author | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-11-20 14:54:40 +0000 |
commit | 84adefa331c4159d432d22840663c38f155cd4c1 (patch) | |
tree | bff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/gs/doc/src/examples/ex5.erl | |
download | otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2 otp-84adefa331c4159d432d22840663c38f155cd4c1.zip |
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/gs/doc/src/examples/ex5.erl')
-rw-r--r-- | lib/gs/doc/src/examples/ex5.erl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/gs/doc/src/examples/ex5.erl b/lib/gs/doc/src/examples/ex5.erl new file mode 100644 index 0000000000..e608709991 --- /dev/null +++ b/lib/gs/doc/src/examples/ex5.erl @@ -0,0 +1,27 @@ +-module(ex5). +-copyright('Copyright (c) 1991-97 Ericsson Telecom AB'). +-vsn('$Revision: /main/release/2 $ '). + +-export([start/0, init/0, b1/0, b2/0]). + +start() -> + spawn(ex5, init, []). + +init() -> + S = gs:start(), + W = gs:create(window,S,[{map,true}]), + gs:create(button,W,[{label,{text,"Button1"}},{data,{ex5,b1,[]}},{y,0}]), + gs:create(button,W,[{label,{text,"Button2"}},{data,{ex5,b2,[]}},{y,40}]), + loop(). + +loop()-> + receive + {gs,_,click,{M,F,A},_} -> % any button pressed + apply(M,F,A), + loop() + end. + +b1() -> + io:format("Button 1 pressed!~n",[]). +b2() -> + io:format("Button 2 pressed!~n",[]). |