Page 1 of 1

There is an error in a sample program?

Posted: Thu Jun 05, 2014 7:57 pm
by PaPi
I tried one of the sample program: examplesgraphicspie.bas
The program source:
-----------------------------------------------
object myform as form
  onpaint=test
end object
myform.showmodal

sub test
  dim x as integer,y as integer,r as integer
  x=myform.clientwidth/2
  y=myform.clientheight/2
  r=70
  myform.canvas.pie(x,y,r,0,60,0,rgb(255,0,0))
  myform.canvas.pie(x,y,r,60,110,0,rgb(0,255,0))
  myform.canvas.pie(x,y,r,110,260,0,rgb(0,0,255))
  myform.canvas.pie(x,y,r,260,360,0,rgb(0,255,255))
end sub
-----------------------------------------------
The compiler gives this error message:
error 72 line 6 `TEST` already used

What can I do now?
PaPi

There is an error in a sample program?

Posted: Fri Jun 06, 2014 9:01 am
by cvirus
Try it with a different var name like this:

[code]object myform as form
  onpaint=tests
end object
myform.showmodal

sub tests
  dim x as integer,y as integer,r as integer
  x=myform.clientwidth/2
  y=myform.clientheight/2
  r=70
  myform.canvas.pie(x,y,r,0,60,0,rgb(255,0,0))
  myform.canvas.pie(x,y,r,60,110,0,rgb(0,255,0))
  myform.canvas.pie(x,y,r,110,260,0,rgb(0,0,255))
  myform.canvas.pie(x,y,r,260,360,0,rgb(0,255,255))
end sub[/code]

I think that the TEST is a var used by fnxbasic an gives an conflict, this must be like an ID it must be unique.

Thanks