There is an error in a sample program?

In this category you can exchange your programming questions and solutions.
Post Reply
PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

There is an error in a sample program?

Post: # 1186Post PaPi
Thu Jun 05, 2014 7:57 pm

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

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

There is an error in a sample program?

Post: # 1187Post cvirus
Fri Jun 06, 2014 9:01 am

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

Post Reply