Page 1 of 1

Posted: Sun Jun 23, 2002 9:11 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

DrawText command and array as parameter not working!!!

Dim sname.s(5)
sname(1)="Text"

This is not working

Code: Select all

 
StartDrawing(ImageOutput())
  Locate (10,10)
  Drawtext (sname(1))    ;Gives error: incorrect numbers of parameters
StopDrawing()
This is working

Code: Select all

StartDrawing(ImageOutput())
  Locate (10,10)
  tmp.s= sname(1)
  Drawtext (tmp)    
StopDrawing()

Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Sun Jun 23, 2002 9:26 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> Drawtext (sname(1)) ;Gives error: incorrect numbers of parameters

Works for me when I used WindowOutput for a test, so I don't know if it's a bug
with ImageOutput() or something else. But DrawText(sname(1)) definitely didn't
cause an error for me about incorrect number of parameters...


PB - Registered PureBasic Coder

Posted: Sun Jun 23, 2002 9:36 pm
by BackupUser
Restored from previous forum. Originally posted by Branston.

Cor, I tried the code below and it works fine here with no errors.
I see a black square with the letter Text in the top left hand corner.

But I am using PB version 3.2
Could that be it?





;-----------------------------------------------
Dim sname.s(5)
sname(1)="Text"


CreateImage(0,200,200)

StartDrawing(ImageOutput())
Locate (10,10)
DrawText (sname(1)) ;Gives error: incorrect numbers of parameters
StopDrawing()

StartDrawing(WindowOutput())

DrawImage(ImageID(), 200, 200)

StopDrawing()

Posted: Sun Jun 23, 2002 9:58 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

This is some code which is used.

If you copy: sname(k,dotnamepos(k) into
DrawText(sname(k,dotnamepos(k)) it gives that error

I'am using 3.2 with the latest updates

Code: Select all

 
Procedure UpdateDots()
DrawingFont(UseFont(0))
Protected k
For k = 1 To #nrstrings
  Select stringpos(k)
    Case 0
      Locate(#xdiagram-2+(#stringwidth*k-1),#yfretpos-20)
      DrawText("o")
      Locate(#xdiagram-2+(#stringwidth*k-1),#ydiagram+(#stringheight*16+8))
      tmp.s=sname(k,dotnamepos(k))
      DrawText(tmp)
    Case -1
      Locate(#xdiagram-2+(#stringwidth*k-1),#yfretpos-20)
      DrawText("x")
     Default
      Circle (#xfretpos+(#stringwidth*(k-1)),stringpos(k),6,RGB(0,0,0))  
      Locate(#xdiagram-2+(#stringwidth*k-1),#ydiagram+(#stringheight*16+8))
      tmp.s=sname(k,dotnamepos(k))
      DrawText(tmp)
      
EndSelect
Next k
EndProcedure

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Edited by - cor on 23 June 2002 23:00:31

Posted: Sun Jun 23, 2002 10:04 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> tmp.s=sname(k,dotnamepos(k))

Is the sname array one or two-dimensional? You only have it as one in your
first example, but as two here, which may explain the parameters error...


PB - Registered PureBasic Coder

Posted: Sun Jun 23, 2002 10:23 pm
by BackupUser
Restored from previous forum. Originally posted by Branston.
This is some code which is used.

If you copy: sname(k,dotnamepos(k) into
DrawText(sname(k,dotnamepos(k)) it gives that error

I'am using 3.2 with the latest updates
Are you missing a ")" in that line?

Posted: Mon Jun 24, 2002 6:41 am
by BackupUser
Restored from previous forum. Originally posted by cor.

Are you missing a ")" in that line?

Thanks Branston,

I must have gotten very small eyes, I just didn't noticed that it was missing the last ")".

It's working now

Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Mon Jun 24, 2002 7:37 am
by BackupUser
Restored from previous forum. Originally posted by Branston.