aboutsummaryrefslogtreecommitdiffstats
path: root/lib/gs/doc/src/examples/ex17.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/gs/doc/src/examples/ex17.erl
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/gs/doc/src/examples/ex17.erl')
-rw-r--r--lib/gs/doc/src/examples/ex17.erl32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/gs/doc/src/examples/ex17.erl b/lib/gs/doc/src/examples/ex17.erl
new file mode 100644
index 0000000000..f659b42ae3
--- /dev/null
+++ b/lib/gs/doc/src/examples/ex17.erl
@@ -0,0 +1,32 @@
+-module(ex17).
+-copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
+-vsn('$Revision: /main/release/1 $ ').
+
+-export([start/0,init/0]).
+
+start() -> spawn(ex17, init, []).
+
+init() ->
+ WH = [{width,200},{height,300}],
+ Win = gs:window(gs:start(),[{map,true},{configure,true},
+ {title,"Packer Demo"}|WH]),
+ gs:frame(packer,Win,[{packer_x,[{stretch,1,50},{stretch,2,50},
+ {stretch,1,50}]},
+ {packer_y,[{fixed,30},{stretch,1}]}]),
+ gs:button(packer,[{label,{text,"left"}},{pack_xy,{1,1}}]),
+ gs:button(packer,[{label,{text,"middle"}},{pack_xy,{2,1}}]),
+ gs:button(packer,[{label,{text,"right"}},{pack_xy,{3,1}}]),
+ gs:editor(packer,[{pack_xy,{{1,3},2}},{vscroll,true},{hscroll,true}]),
+ gs:config(packer,WH), % refresh to initial size
+ loop().
+
+loop() ->
+ receive
+ {gs,_Id,destroy,_Data,_Arg} -> bye;
+ {gs,_Id,configure,_Data,[W,H|_]} ->
+ gs:config(packer,[{width,W},{height,H}]), % repack
+ loop();
+ Other ->
+ io:format("loop got: ~p~n",[Other]),
+ loop()
+ end.