<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Try this instead
<br>
<p>-module(line2).
<br>-export([start/0, internal/0]).
<p>start() ->
<br> spawn(line2, internal, []).
<p>internal() ->
<br> I = gs:start(),
<br> Win = gs:window(I, [{map,true},{title, "Demo"},
{width, 200}, {height,270}]),
<br> Path = [{10,50}, {30, 50}, {30, 60}, {60, 60}],
<br> Canvas = gs:canvas(Win,[]),
<br> gs:line(Canvas,[{width,2}, {coords,Path}]),
<br> gs:config(Win, {map, true}).
<br> loop().
<p>loop() ->
<br> receive
<br> Any ->
<br> ok
<br> end,
<br> loop().
<p>To add to Francesco comments You must have some sort of
loop at the end to ensure the process will not end prematurely Otherwise
your window will be destroyed.
<p>All the best
<p>Tony
<p>Francesco Cesarini wrote:
<blockquote TYPE=CITE>Hi Priya,
<br>you have an error in your code. What happens is that a new process
is
<br>spawned, but it crashes when executing .
<p>gs:draw_line(Win, solid, 2, Path)
<p>Which does not exist.
<p>The error is not detected at compile time because Erlang modules are
<br>compiled on a stand alone basis and not linked to each other.
<p>You can easily find the error by calling internal/0 directly from the
<br>shell
<br>6> line2:internal().
<br>** exited: {undef,{gs,draw_line,
<p>[{5,<0.45.0>},solid,2,[{10,50},{30,50},{30,60},{60,60}]]}} **
<br>7>
<p>Other errors include the fact that line takes a canvas as a parent and
<br>not a Window. Look at the online documentation @
<br><a href="http://www.erlang.org/doc/current/lib/gs-1.3.7/doc/index.html">http://www.erlang.org/doc/current/lib/gs-1.3.7/doc/index.html</a>
for exact
<br>parameters to pass to the function.
<p>Regards,
<br>Francesco
<br>--
<br>Francesco Cesarini
<p>Erlang/OTP consultant
<br>Cellular: INT+44-7776 250381
<br>ECN: 832-707192
<br><a href="http://welcome.to/cesarini.consulting">http://welcome.to/cesarini.consulting</a>
<p>Priya Paramasevam wrote:
<br>>
<br>> hello
<br>>
<br>> i did it again .. i accidentally sent the mail without completing
it.
<br>> i have compiled and run some of the example programs provided together
<br>> with GS. they run fine. but when i test a simple program that i wrote
<br>> myself, i can't seem to see the output.
<br>>
<br>> here is my code:
<br>>
<br>> -module(line2).
<br>> -export([start/0, internal/0]).
<br>>
<br>> start() ->
<br>> spawn(line2, internal,
[]).
<br>>
<br>> internal() ->
<br>> I = gs:start(),
<br>> Win = gs:window(I,
[{title, "Demo"}, {width, 200}, {height,
<br>> 270}]),
<br>> Path = [{10,50},
{30, 50}, {30, 60}, {60, 60}],
<br>> gs:draw_line(Win,
solid, 2, Path),
<br>> gs:config(Win, {map,
true}).
<br>>
<br>> there isn't any problem compiling, but there is no output. can you
please
<br>> tell me what is wrong?
<br>>
<br>> thank you so much and sorry for the redundant meaningless mails.
<br>>
<br>> Kind Regards,
<br>> Priya Paramasevam
<br>> Master of Applied Science (IT)
<br>> RMIT University,
<br>> Melbourne, Australia.
<br>>
<br>>
<br>> ==========================================================================
<br>> A good sense of humour, a big dose of patience, and a
dash of humility,
<br>>
you will be rewarded many-fold!
<br>> ==========================================================================
<br>>
<br>> On Tue, 24 Oct 2000, Simon Bennett wrote:
<br>>
<br>> > Gerald Biederbeck wrote:
<br>> >
<br>> > > I installed GS and Erlang too.
<br>> > > It works fine.
<br>> > >
<br>> > > Priya Paramasevam wrote:
<br>> > >
<br>> > > > I am using Erlang to develop a simulation. I need
to use GS for this. I
<br>> > > > have installed Erlang and GS on my computer. Unfortunately,
I am not able
<br>> > > > to view the GS window.
<br>> >
<br>> > What I think Gerald is saying is that you have not given people
on the
<br>> > list much to go on....
<br>> >
<br>> > For example:
<br>> >
<br>> > What operating system are you using?
<br>> >
<br>> > What version of Erlang are you using?
<br>> >
<br>> > Is OTP installed as part of the Erlang installation or separately?
If
<br>> > the latter, have you installed it?
<br>> >
<br>> > What have you actually done to test it? Run an existing program?
<br>> > Written your own program? Entered commands in the shell?
<br>> >
<br>> > What was the response? Did any error messages appear anywhere?
<br>> >
<br>> > Simon Bennett
<br>> > Information Systems Consultant
<br>> > ___________________________________________________________________
<br>> >
<br>> > Simon Bennett
E-mail: simonb@terminus.ericsson.se
<br>> > Ericsson Intracom
<a href="http://www.ericsson.co.uk/UK/intracom">http://www.ericsson.co.uk/UK/intracom</a>
<br>> > 1 Bede Island Road Voice
(UK) 0116 2542400
<br>> > Leicester
Voice (int) +44 116 2542400
<br>> > England
Voice ECN: 832 707 ext 232
<br>> > LE2 7EU
Fax: +44 (0)116 2046111
<br>> > ___________________________________________________________________
<br>> >
<p>--
<br>Francesco Cesarini
<p>Erlang/OTP consultant
<br>Cellular: INT+44-7776 250381
<br>ECN: 832-707192</blockquote>
<pre>--
______________________________________________________________________
Tony Pedley <A HREF="mailto:tonyp@terminus.ericsson.se">mailto:tonyp@terminus.ericsson.se</A>
Ericsson Intracom Ltd. Intranet : <A HREF="http://intracom.ericsson.se">http://intracom.ericsson.se</A>
1 Bede Island Internet : <A HREF="http://www.ericsson.co.uk/datacom/index.htm">http://www.ericsson.co.uk/datacom/index.htm</A>
Leicester memoID : ECOM.CBERAM
England Tel : +44 (0)116 2 542 400
LE2 7EU Fax : +44 (0)116 2 046 111
______________________________________________________________________</pre>
</html>