Recent

Author Topic: How can I use Free Pascal within XCode Version 8?  (Read 5424 times)

laguna

  • Sr. Member
  • ****
  • Posts: 323
How can I use Free Pascal within XCode Version 8?
« on: August 04, 2017, 08:34:22 am »
I would like to use XCode IDE, and its GUI, to draw the interface, and at the same time use the FreePascal language to program it, is it possible?
If so, can you tell me, kindly, how can I proceed?

Thank you all.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How can I use Free Pascal within XCode Version 8?
« Reply #1 on: August 04, 2017, 02:48:07 pm »
I would like to use XCode IDE, and its GUI, to draw the interface, and at the same time use the FreePascal language to program it, is it possible?

Yes, you can do that for both macOS and iOS apps. See this article:

https://macpgmr.github.io/ObjP/ProjectXC.html


laguna

  • Sr. Member
  • ****
  • Posts: 323
Re: How can I use Free Pascal within XCode Version 8?
« Reply #2 on: August 05, 2017, 04:20:59 pm »
Thanks, I was able to create the first basic project.
I created a button in the main window;
I declared the structure in the ViewController
But I did not understand how to link the actions of the button "Button1" to the code,
can you help me.

Code: Pascal  [Select][+][-]
  1. type
  2.   ViewController = objcclass(NSViewController)
  3.      {IBOutlets}
  4.      button1 : NSButton;
  5.     //    procedure viewDidLoad; override;
  6.     //   viewDidLoad not in CocoaAll (added to OS X 10.10), so declare with message:
  7.     procedure viewDidLoad; message 'viewDidLoad';
  8.     procedure setRepresentedObject(representedObject: id); override;
  9.     procedure dealloc; override;
  10.  
  11.      {IBActions}
  12.     procedure button1Click(sender: id); message 'button1Click:';
  13.   end;
  14.  
  15.  
  16. implementation
  17.  
  18.  
  19. procedure ViewController.button1Click(sender: id);
  20. begin
  21.  
  22. end;
  23.  

Thanks again.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How can I use Free Pascal within XCode Version 8?
« Reply #3 on: August 05, 2017, 04:27:32 pm »
But I did not understand how to link the actions of the button "Button1" to the code,

Follow the steps given here:

https://macpgmr.github.io/ObjP/ProjectXC.html#AddingUI

laguna

  • Sr. Member
  • ****
  • Posts: 323
Re: How can I use Free Pascal within XCode Version 8?
« Reply #4 on: August 05, 2017, 04:59:43 pm »
I created in: ViewController.h

Code: Pascal  [Select][+][-]
  1.  
  2. @property (weak) IBOutlet NSButton *button1;
  3. - (IBAction)button1Click:(NSButton *)sender {
  4. }
  5.  

I hope I understand, I'm trying to simulate the example in the guide.

At button1 I want to change name to button1.
But the commands
Code: Pascal  [Select][+][-]
  1. button1.text :='hello';
  2. button1.capiton:='hello';
  3. button1.setTilte('hello'):
Do not work.

or ShowMessage('hello');
do not work.




« Last Edit: August 05, 2017, 05:03:13 pm by laguna »

laguna

  • Sr. Member
  • ****
  • Posts: 323
Re: How can I use Free Pascal within XCode Version 8?
« Reply #5 on: August 06, 2017, 11:54:54 am »

Set Caption/Title Button resolved:  button1.setTitle(NSSTR('Button title!'));

ShowMessage with units Dialogs send Error: Identifier not found,
prlease help me!

Thanks


laguna

  • Sr. Member
  • ****
  • Posts: 323
Re: How can I use Free Pascal within XCode Version 8?
« Reply #6 on: August 06, 2017, 01:20:34 pm »
How to use LIBRARY (UNIT) fpc, indy etc in ProjectXC?

Thanks

 

TinyPortal © 2005-2018