aadd array on Harbour

aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 1: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: aadd array on Harbour

Postby Otto » Thu Apr 14, 2016 2:33 pm

Silvio,
could you provide us with a small self-containing example?
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 2: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: aadd array on Harbour

Postby hmpaquito » Thu Apr 14, 2016 3:03 pm

which is description compiler error ?
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 3: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: aadd array on Harbour

Postby karinha » Thu Apr 14, 2016 3:40 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 3:42 pm

Perhaps I found a problem

if I use WINDOW it run ok

if use DIALOG NOT RUN MAKE ERROR

WHY ?
Last edited by Silvio.Falconi on Thu Apr 14, 2016 4:05 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: aadd array on Harbour

Postby karinha » Thu Apr 14, 2016 4:03 pm

I do not know, I do not use harbour only xHarbour.

This is really correct?

Code: Select all  Expand view

   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
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: aadd array on Harbour

Postby hmpaquito » Thu Apr 14, 2016 4: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
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 4:11 pm

THIS IS CORRECT
Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: aadd array on Harbour

Postby Silvio.Falconi » Thu Apr 14, 2016 6: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 87 guests