Sorry, another one. It is not further documented. The method below originally yielded an error because it was of CLASS TextControl. As it is only used to set the Textcolor of 1 or 2 SLE's I changed it to class IC2SLE (my SingleLineEdit subclass) and moved it (in X#) to a prg with other methods of this class. So it looks now as follows:
PARTIAL CLASS IC2SLE INHERIT SingleLineEdit
....
METHOD TextColor(uValue)
SELF:TextColor:=uValue
RETURN NIL
Works as expected in VO, but in X# it gives this error:
Error XS0505 'IC2SLE.TextColor(params XSharp.__Usual[])': cannot override because 'VO.TextControl.TextColor' is not a function IC2 lib C:XporterOutputOkIC2 libControl.prg 459
What does this mean?
Dick
Error XS0505 ..cannot override because .. is not a function
Error XS0505 ..cannot override because .. is not a function
Dick,
In DotNet you cannot have a method and a field or property with the same name.
Your code declares a method TextColor and the class already has a property TextColor.
If you enable the compiler option "all methods are virtual" then we add the Override modifier to all methods that you declare in your code. The backend (Roslyn) is getting confused because it finds a TextColor property and tries to override that, but you are overriding the property with a method.
Of course the question is: why did you add a method when there is already a property (ACCESS/ASSIGN in VO)?
Robert
In DotNet you cannot have a method and a field or property with the same name.
Your code declares a method TextColor and the class already has a property TextColor.
If you enable the compiler option "all methods are virtual" then we add the Override modifier to all methods that you declare in your code. The backend (Roslyn) is getting confused because it finds a TextColor property and tries to override that, but you are overriding the property with a method.
Of course the question is: why did you add a method when there is already a property (ACCESS/ASSIGN in VO)?
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Error XS0505 ..cannot override because .. is not a function
Hello Robert,
SELF:oDCmSomeSLEField:TextColor(Color{nOpmFGR,nOpmFGG,nOpmFGB}) (where the 3 parameters are the foreground RGB colours)
If I rename the METHOD TextColor(uValue) the field is not colored anymore. At least, in VO (I have not yet converted the library where this TextColor call is applied). No idea why not to be honest.
I already set All instance methods are virtual to true but the error remained.
Dick
I asked myself the same question: why did I write this 18 years ago. This is the code which uses that method:Of course the question is: why did you add a method when there is already a property (ACCESS/ASSIGN in VO)?
SELF:oDCmSomeSLEField:TextColor(Color{nOpmFGR,nOpmFGG,nOpmFGB}) (where the 3 parameters are the foreground RGB colours)
If I rename the METHOD TextColor(uValue) the field is not colored anymore. At least, in VO (I have not yet converted the library where this TextColor call is applied). No idea why not to be honest.
I already set All instance methods are virtual to true but the error remained.
Dick