xsharp.eu • Method calls in Codeblocks
Page 1 of 1

Method calls in Codeblocks

Posted: Mon Feb 27, 2023 8:20 pm
by stefan.ungemach
I hope that this is a trivial problem:

I declare a simple codeblock like this

aInfo[2] := {#PERSJAHR, { { {|oSrv| oSrv:FG( #PZZADNR ) }, 1, {|Jahr, AGS, PK| PK }, .f. }}}

which will receive a class instance that has a FG method. However, the compiler throws

Fehler XS1061 'usual' does not contain a definition for 'FG' and no accessible extension method 'FG' accepting a first argument of type 'usual' could be found (are you missing a using directive or an assembly reference?) lib_(F9 generiert)_KOBIncludes C:Usersstefan.ungemachsourcereposXSharpXBasislib_(F8 generiert)_KOBIncludes_PK.PRG 19

From all I know this should work and I have other places in the code where this works. What am I missing (an include, a USING-statement...)?

Method calls in Codeblocks

Posted: Mon Feb 27, 2023 8:34 pm
by Chris
Hi Stefan,

Yes, it is trivial! You just need to enable the option to allow late binding in the project options window, and it should compile fine.

.

Method calls in Codeblocks

Posted: Mon Feb 27, 2023 8:53 pm
by stefan.ungemach
Thank you - that was missing in one of my projects. Still need more routine... ;)