Error in a class : default variable

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Error in a class : default variable

Post by Silvio »

in xharbour or habour in a class there is this line :

Code: Select all

Default nWidth  = 25, ;
           nHeight = 25
but when i compiled make an error

Code: Select all

Error E0030  Syntax error: "parse error at 'NWIDTH'"
How ca I resolve it

Regards,
silvio
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Silvio,

you missed the double point, this is correct:

Code: Select all

DEFAULT nWidth := 25 ,;
                       nHeight :=25
Stefan
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post by R.F. »

Please notice that "DEFAULT" is a command written in the FIVEWIN.CH header file.

If you don't include the FIVEWIN.CH file in you programm you will not have the DEFAULT command available, so the compiling process will fail.

Anyway if you are not using FIVEWIN with your class, you can write the command yourself in the source code or include it in any other header file:

Code: Select all

#xcommand DEFAULT <uVar1> := <uVal1> ;
               [, <uVarN> := <uValN> ] => ;
                  <uVar1> := If( <uVar1> == nil, <uVal1>, <uVar1> ) ;;
                [ <uVarN> := If( <uVarN> == nil, <uValN>, <uVarN> ); ]
Saludos
R.F.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

thank to all
this class printer is modified by klm but in xharbout not runned : now run ok
Post Reply