On 28 Jan 2010, at 15:26, Felipe Monteiro de Carvalho wrote:

I am having trouble with the delphi mode and objective pascal. If I
use this defines:

{$mode delphi}{$modeswitch objectivec1}

Then I get an error in this line:

 MainWindow.contentView.addSubview(TextField);

simpleform.lpr(63,26) Error: Unknown record field identifier "ADDSUBVIEW"

And in this one too:

 NSApp.run;

simpleform.lpr(71,9) Error: Unknown record field identifier "RUN"

If I use

{$mode objfpc}{$modeswitch objectivec1}

then everything builds fine.

Please file a bug report with a small, compilable self-contained example.

Also, some more things:

Is creating the autorelease pool necessary or will the compiler do it
automatically?

autorelease pools are not part of the language, they are part of the Cocoa framework. The compiler never automatically creates them.

I see that it isn't created in some examples which use
NSApplicationMain, and in the docs of this routine It's never said
that it will create the autorelease pool.

From http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#/ /apple_ref/doc/uid/20000012-800060, last paragraph of "Overview" :

"The NSApplication class sets up autorelease pools (instances of the NSAutoreleasePool class) during initialization and inside the event loop—specifically, within its initialization (or sharedApplication) and run methods."

Also, should I initialize NSApp or just use the default? I remember
that one needed to initialize it in PasCocoa with:

 NSApp := NSApplication.sharedApplication;

See again http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#/ /apple_ref/doc/uid/20000012-800060, but the first two paragraphs of "Overview".


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to