FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour aadd array on Harbour
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
aadd array on Harbour
Posted: Thu Apr 14, 2016 01:29 PM

when I compile with harbour give me an error on this line

AAdd( ::aLinea[k], ::GetCode(ALLTRIM( ::aTextLinea[k][nI] ) ) )

why ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 02:33 PM

Silvio,
could you provide us with a small self-containing example?
Otto

Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 02:49 PM

please download tled class and try the sample test with harbour

https://bitbucket.org/fivetech/fivewin- ... s/tled.zip
with xharbour run ok !!

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 03:03 PM

which is description compiler error ?

Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 03:19 PM
Application
===========
Path and name: F:\versioni_TLed\tLed\Array\CodeLed.Exe (32 bits)
Size: 3,398,144 bytes
Compiler version: Harbour 3.2.0dev (r1406271520)
FiveWin Version: FWH 16.03
Windows version: 6.1, Build 7600

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 04/14/16, 15:48:07
Error description: Error BASE/1068 Argument error: array access
Args:
[ 1] = C 12345678901234567890
[ 2] = N 1
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 03:40 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 03:42 PM
Perhaps I found a problem

if I use WINDOW it run ok

if use DIALOG NOT RUN MAKE ERROR

WHY ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 04:03 PM
I do not know, I do not use harbour only xHarbour.

This is really correct?

Code (fw): Select all Collapse
   DATA aTextLinea      AS ARRAY   INIT {}

   ::aTextLinea  := Array(::nLedLines)


 METHOD CheckLines() CLASS TLed
   Local nI,k


   ::aLinea:=array(LEN(::aTextLinea))


           For j=1 to LEN(::aTextLinea)
               ::aLinea[j]:={}
            next


         For k=1 To len(::aLinea)
              For nI := 1 to ::nLedCharacters
                     IF ni <= LEN( ::aTextLinea[k] )
                       AAdd( ::aLinea[k], ::GetCode(ALLTRIM( ::aTextLinea[k][nI]  ) ) )
                     ELSE
                       AAdd( ::aLinea[k], ::GetCode( " " )  )
                    ENDIF
                 Next
              Next

    RETURN NIL


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 04:09 PM

Silvio.

1st. Is not a compiler error but run time error. Ok.

2nd. Error is here: ::aTextLinea[k][nI] because ::aTextLinea[k] is a string and not is a array.
Adressing string with [] operator is only valid in xHarbour compiler. Neither Clipper or harbour support it.

SubStr(::aTextLinea[k], nI, 1) is a compatible replace for all compilers.

Regards

Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 04:11 PM
THIS IS CORRECT
Code (fw): Select all Collapse
METHOD CheckLines() CLASS TLed
   Local nI,k,j
   ::aLinea:=array(LEN(::aTextLinea))

           For j=1 to LEN(::aTextLinea)
               ::aLinea[j]:={}
            next


         For k=1 To len(::aLinea)
              For nI = 1 to ::nLedCharacters
                     IF ni <= LEN( ::aTextLinea[k] )
                       AAdd( ::aLinea[k], ::GetCode(ALLTRIM( ::aTextLinea[k][nI]  ) ) )
                     ELSE
                       AAdd( ::aLinea[k], ::GetCode( " " )  )
                    ENDIF
                 Next
              Next

    RETURN NIL




I ADD ALSO ON NEW METHOD BEFORE THE RETURN SELF THIS LINE

SetWndDefault( oWnd )




ON WINDOW RUN OK BUT ON DIALOG NOW ( HERE) NOT SHOW THE CONTROL
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: aadd array on Harbour
Posted: Thu Apr 14, 2016 06:08 PM

if I change on

AAdd( ::aLinea[k], ::GetCode(ALLTRIM( SubStr(::aTextLinea[k], nI, 1) ) ) )

then it make error on Paint method

For nHeight := 1 to (LEN(::aTextLinea))
For nWidth := 1 to (::nLedCharacters)
aChar := ::aLinea[nHeight][nWidth]
For k := 1 to 8
nLineax := ( (nHeight-1) * ( ( ::nLedHeight * 9 ) + ( ::nLedSpace * 8 ) ) ) + ( (k-1) * ( ::nLedHeight + ::nLedSpace ) ) + ( ::nLedWidth + 3 )
cFila := aChar[k]
For w := 1 to 5
nLineay := ( (nWidth-1) * ( ( ::nLedWidth * 7 ) + ( ::nLedSpace * 4 ) ) ) + ( w * ( ::nLedWidth + ::nLedSpace ) ) + ( ::nLedWidth + 3 )
---> nColorPixel := IIF( cFila[w] == "*", ::nColorLedON, ::nColorLedOFF)
FillSolidRect( ::hDC, { nLineax, nLineay, nLineax + ::nLedHeight, nLineay + ::nLedWidth}, nColorPixel)
Next
Next
Next
Next

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion