Difference between revisions of "Cocoa Interface"

From Free Pascal wiki
(Platform template updated.)
Line 3: Line 3:
 
{{Other Interfaces}}
 
{{Other Interfaces}}
 
==Cocoa bindings==
 
==Cocoa bindings==
When this interface was started, it used a set of wrappers to access Cocoa, called [[PasCocoa]]. After this, native support in Free Pascal for direct communication with Objective-C was added through the [[FPC PasCocoa|Objective Pascal]] dialect.
+
This interface uses the native support in Free Pascal for direct communication with Objective-C was added through the [[FPC PasCocoa|Objective Pascal]] dialect.
 
 
==Compiling the Cocoa Interfaces==
 
 
 
If you want to try Cocoa widgetset, or use some Cocoa features from Carbon application, you'll need to install PasCocoa library first.
 
 
 
'''1 - Download PasCocoa from subversion'''
 
 
 
Instructions here: [[PasCocoa#Subversion]]
 
 
 
'''2- Add the path to PasCocoa to your fpc.cfg file'''
 
 
 
In a standard installation this file will be located in: /etc/fpc.cfg
 
 
 
Please add at the end of this file the following (remember to adapt it to the paths in your system!):
 
 
 
<pre>
 
# Search path for Cocoa bindings
 
-Fu/Users/felipe/Programas/lazarus-ccr/bindings/objc
 
-Fu/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/appkit
 
-Fu/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/foundation
 
-Fu/Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/applicationservices/coregraphics
 
</pre>
 
 
 
Since the file is write protected, only administrator accounts will be able to edit it. It is also possible to have a local fpc.cfg file. For more information google or ask in the mailling list.
 
 
 
'''3 - Compile a test PasCocoa project'''
 
 
 
In Lazarus, open /Users/felipe/Programas/lazarus-ccr/bindings/pascocoa/example/statusitem/statusitem.lpi (or similar acording to your local paths) and build the project.
 
 
 
This should guarantee that PasCocoa was installed correctly and create the .o files for it.
 
 
 
'''4 - Compile LCL-Cocoa'''
 
 
 
In Lazarus go to the Tools-->Configure Build Lazarus menu. Go to advanced, set everything to NONE and only LCL to clean+build, set the widgetset to Cocoa and push the Build button.
 
 
 
You can now build LCL-Cocoa applications by setting the target widgetset to cocoa in the Compiler Options dialog of your projects.
 
  
 
==Roadmap==
 
==Roadmap==

Revision as of 16:26, 12 November 2015

Stock-dialog-warning.svg

This article applies to Mac OS X only.

See also: Multiplatform Programming Guide

Apple iOS new.svg

This article applies to iOS only.

See also: Multiplatform Programming Guide

Other Interfaces

Platform specific Tips

Interface Development Articles

Cocoa bindings

This interface uses the native support in Free Pascal for direct communication with Objective-C was added through the Objective Pascal dialect.

Roadmap

Located here: Roadmap#Status_of_features_on_each_widgetset