<DIV style="font-family:Arial, sans-serif; font-size:10pt;"><FONT size="2"><SPAN style="font-family: Arial,sans-serif;"></SPAN></FONT>Newbie question:
<BR><DIV style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">
<BR>I am looking at the docs for gs
<BR>and am trying to modify ex9
<BR>(copied below from
<BR>/lib/gs-1.5.7/doc/html/gs_chapter8.html).
<BR>
<BR>I want the window to stay open after sending
<BR>a name tuple to the console, so another name
<BR>tuple can be sent.  I don't want the window
<BR>to close unless I click the cancel button
<BR>(or the top-right X button).
<BR>
<BR>I've tried adding loop(Pid) at the end of the two receive
<BR>clauses which call Text=gs:read(entry,text), but get strange
<BR>results. (this on XP, using werl).
<BR>
<BR>Can someone show me how to do it? Thanks.
<BR>----------
<BR>from the docs:
<BR>
<BR>-module(ex9).
<BR>-copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
<BR>-vsn('$Revision: /main/release/2 $ ').
<BR>
<BR>-export([start/0,init/1]).
<BR>
<BR>start() ->
<BR>    spawn(ex9, init, [self()]),
<BR>    receive
<BR>        {entry_reply, Reply} -> Reply
<BR>    end.
<BR>
<BR>init(Pid) ->
<BR>    S = gs:start(),
<BR>    Win = gs:create(window,S,[{title,"Entry Demo"},
<BR>                              {width,150},{height,100}]),
<BR>    gs:create(label,Win,[{label,{text,"What's your name?"}},
<BR>                         {width,150}]),
<BR>    gs:create(entry,entry,Win,[{x,10},{y,30},{width,130},
<BR>                               {keypress,true}]),
<BR>    gs:create(button,ok,Win,[{width,45},{y,60},{x,10},
<BR>                             {label,{text,"Ok"}}]),
<BR>    gs:create(button,cancel,Win,[{width,60},{y,60},{x,80},
<BR>                                 {label,{text,"Cancel"}}]),
<BR>    gs:config(Win,{map,true}),
<BR>    loop(Pid).
<BR>
<BR>loop(Pid) ->
<BR>    receive
<BR>        {gs,entry,keypress,_,['Return'|_]} ->
<BR>            Text=gs:read(entry,text),
<BR>            Pid ! {entry_reply,{name,Text}};
<BR>        {gs,entry,keypress,_,_} -> % all other keypresses
<BR>            loop(Pid);
<BR>        {gs,ok,click,_,_} ->
<BR>            Text=gs:read(entry,text),
<BR>            Pid ! {entry_reply,{name,Text}};
<BR>        {gs,cancel,click,_,_} ->
<BR>            Pid ! {entry_reply,cancel};
<BR>        X ->
<BR>            io:format("Got X=~w~n",[X]),
<BR>            loop(Pid)
<BR>    end.
<BR>
<BR>
<BR></DIV><BR><FONT size="2"><SPAN style="font-family: Arial,sans-serif;"><BR><BR></SPAN></FONT></DIV>