GS application

matthias <>
Wed Oct 25 12:55:18 CEST 2000


Hi,

You might want to have a look at the example code which comes with the
library and modify that one step at a time. You're hitting a couple of
problems:

  1. There is no function called gs:draw_line. (What made you think
     there was?)

  2. Your program spawns a process which creates a window and
     then dies. Since your process died, everything you did in
     gs dies too.

  (3. You spawn the process without linking, so you never get notice
      of it dying.)

Here's a program which does what I think you're trying to do:

	-module(line2).
	-export([start/0, internal/0]).
	
	start() ->
	        spawn_link(line2, internal, []).
	
	internal() ->
	        I = gs:start(),
	        Win = gs:window(I, [{title, "Working demo"}, {width, 200}, 
			{height, 270}]),
	        Path = [{10,50}, {30, 50}, {30, 60}, {60, 60}],
	        gs:config(Win, {map, true}),
		%% display the window for 10 seconds and then die
		timer:sleep(10000).

You might want to ask someone local (Maurice Castro?) to help you get
started on trying out code using the erlang shell. Your program is a
perfect example of something which is easily debugged using the shell.

Matthias



More information about the erlang-questions mailing list