GS application

Simon Bennett <>
Wed Oct 25 10:50:52 CEST 2000


Hi

Firstly, the process is terminating as soon as it has run your
internal() function, so you don't get to see any output.  Change the
last line to end with a comma and add a line on the end like:
loop(Win).

Then add a function that waits for an event.  The simplest is something
like:

loop(Win) ->
        receive
	{gs,Win,destroy,_Data,_Arg} ->

	    bye
	end.

However, you want it to respond to events, handle them and carry on, so
you will need to write additional receive clauses which do what you want
and then call loop(Win) again.

Secondly, there is a problem with your draw_line statement.  Comment it
out and you'll see the window.  One of the problems with GS is getting
at error information from the TK back-end.  Generally, if you get the
syntax wrong, you get nothing.

I think that to draw a line you need a canvas.  You then need to use
gs:line(...) or gs:create(line,...) and pass that the variable holding
the reference to the canvas.  draw_line looks like it might be a
function that someone has written, but I don't think it's part of GS.

Good luck

Simon

Priya Paramasevam wrote:
> 
> hello
> 
> i did it again .. i accidentally sent the mail without completing it.
> i have compiled and run some of the example programs provided together
> with GS. they run fine. but when i test a simple program that i wrote
> myself, i can't seem to see the output.
> 
> here is my code:
> 
> -module(line2).
> -export([start/0, internal/0]).
> 
> start() ->
>         spawn(line2, internal, []).
> 
> internal() ->
>         I = gs:start(),
>         Win = gs:window(I, [{title, "Demo"}, {width, 200}, {height,
> 270}]),
>         Path = [{10,50}, {30, 50}, {30, 60}, {60, 60}],
>         gs:draw_line(Win, solid, 2, Path),
>         gs:config(Win, {map, true}).
> 
> there isn't any problem compiling, but there is no output. can you please
> tell me what is wrong?
> 
> thank you so much and sorry for the redundant meaningless mails.
> 
> Kind Regards,
> Priya Paramasevam
> Master of Applied Science (IT)
> RMIT University,
> Melbourne, Australia.
> 
> 
> ==========================================================================
>   A good sense of humour, a big dose of patience, and a dash of humility,
>                    you will be rewarded many-fold!
> ==========================================================================
> 
> On Tue, 24 Oct 2000, Simon Bennett wrote:
> 
> > Gerald Biederbeck wrote:
> >
> > > I installed GS and Erlang too.
> > > It works fine.
> > >
> > > Priya Paramasevam wrote:
> > >
> > > >   I am using Erlang to develop a simulation. I need to use GS for this. I
> > > > have installed Erlang and GS on my computer. Unfortunately, I am not able
> > > > to view the GS window.
> >
> > What I think Gerald is saying is that you have not given people on the
> > list much to go on....
> >
> > For example:
> >
> > What operating system are you using?
> >
> > What version of Erlang are you using?
> >
> > Is OTP installed as part of the Erlang installation or separately?  If
> > the latter, have you installed it?
> >
> > What have you actually done to test it?  Run an existing program?
> > Written your own program?  Entered commands in the shell?
> >
> > What was the response?  Did any error messages appear anywhere?
> >
> > Simon Bennett
> > Information Systems Consultant
> > ___________________________________________________________________
> >
> >  Simon Bennett            E-mail:     
> >  Ericsson Intracom        http://www.ericsson.co.uk/UK/intracom
> >  1 Bede Island Road       Voice (UK)  0116 2542400
> >  Leicester                Voice (int) +44 116 2542400
> >  England                  Voice ECN:  832 707 ext 232
> >  LE2 7EU                  Fax:        +44 (0)116 2046111
> > ___________________________________________________________________
> >

-- 
Simon Bennett
Information Systems Consultant
___________________________________________________________________

 Simon Bennett            E-mail:     
 Ericsson Intracom        http://www.ericsson.co.uk/UK/intracom
 1 Bede Island Road       Voice (UK)  0116 2542400
 Leicester                Voice (int) +44 116 2542400
 England                  Voice ECN:  832 707 ext 232
 LE2 7EU                  Fax:        +44 (0)116 2046111
___________________________________________________________________



More information about the erlang-questions mailing list