Recent

Author Topic: How to create GUI applications in macos High Sierra without Lazarus  (Read 4357 times)

gop

  • Newbie
  • Posts: 6
Hello to all.

Unfortunately I am a mac user. I have installed in my system both fpc and fpc-src but not Lazarus (due to well known issues with gdb, which is not supported in High Sierra (*) ).

So, I was wondering if it is possible to create a GUI application for macos, by implementing the minimum possible amount of tools (say, the compiler, a code editor, etc).

I would appreciate any detailed answer, since I am new to Object Pascal.

Thank you in advance.

(*) I do know that there are some "hacking" ways of resolving the gdb problem, but I would not like to use them.
« Last Edit: February 28, 2018, 01:17:20 am by gop »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #1 on: February 28, 2018, 01:20:43 am »
So, I was wondering if it is possible to create a GUI application for macos, by implementing the minimum possible amount of tools (say, the compiler, a code editor, etc).

Sure is. Look at the ProjectXC article here:

https://macpgmr.github.io/

You can develop with Pascal in Xcode. Or you can use Lazarus and then debug in Xcode. You can have it both ways.


gop

  • Newbie
  • Posts: 6
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #2 on: February 28, 2018, 01:58:03 am »
Hello Phil

thank you for the feedback. To be honest I am looking for a solution involving say... sublime text editor, fpc and command line tools. I would not like to mess with neither gdb nor xcode.

Thank you again.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #3 on: February 28, 2018, 02:01:36 am »
thank you for the feedback. To be honest I am looking for a solution involving say... sublime text editor, fpc and command line tools. I would not like to mess with neither gdb nor xcode.

Are you just writing command line apps? If so, that would work fine. Just debug with lldb, as described in article link. Works fine.

If you need to create a GUI, you'll probably want a UI designer of some sort. Lazarus and Xcode both have those. I doubt if "sublime" does (never heard of it - I use BBEdit and Visual Studio Code on Mac).


gop

  • Newbie
  • Posts: 6
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #4 on: February 28, 2018, 02:04:17 am »
Hello again.

No, I would like to develop GUI applications... so leaving aside the command line tools (which are necessary either a way) and, say with VSC or BBBeditorm what else I am going to need?
« Last Edit: February 28, 2018, 02:07:51 am by gop »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #5 on: February 28, 2018, 02:07:48 am »
No, I would like to develop GUI applications... so leaving aside to command line tools (which are necessary either a way) and, say with VSC or BBBeditorm what else I am going to need?

Lazarus or Xcode for designing the UI.

gop

  • Newbie
  • Posts: 6
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #6 on: February 28, 2018, 02:08:38 am »
So there is not a third way... I see.

Again, thank you very much.
« Last Edit: February 28, 2018, 02:11:10 am by gop »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #7 on: February 28, 2018, 02:11:13 am »
So there is no a third way... I see.

Obviously you could do it all in code, but I wouldn't advise that (it's 2018, after all). I don't imagine it's documented very well either since the assumption of almost all docs would be that you're using a designer.

gop

  • Newbie
  • Posts: 6
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #8 on: February 28, 2018, 02:17:12 am »
One last question:

is there any detailed manual on how to produce gui apps using Xcode?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #9 on: February 28, 2018, 02:31:59 am »
One last question:

is there any detailed manual on how to produce gui apps using Xcode?

Do you mean with Pascal or just using Xcode in general?

If the latter, see the Xcode help or Apple's many docs and videos or docs and videos produced by many other sites.

If the former, I would suggest just following the simple example given and see how that feels to you. There's something to be said for successfully completing even a simple task with something brand new: maybe you'll see that it's not really that hard.

The main disadvantage of using Xcode with Pascal is that Xcode doesn't know much about Pascal other than syntax highlighting, so you won't have code completion or help with Pascal syntax in the Xcode code editor. That's why it might make sense to do code editing in Lazarus since you'll have those things there, and do everything else in Xcode (debugging, setting Info.plist and entitlement data, codesigning, etc.).

Pretty much everything else that you see documented about GUI design in Xcode, debugging, etc. applies to Pascal as well. After all, all Xcode is doing when it compiles is running a series of command line tools. When you use Pascal, you're just adding a couple more to the list - not too complicated, really.

dbannon

  • Hero Member
  • *****
  • Posts: 2796
    • tomboy-ng, a rewrite of the classic Tomboy
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #10 on: February 28, 2018, 04:43:26 am »
Quote
I would not like to mess with neither gdb nor xcode.

Well, if its the gdb install you are trying to avoid, you can install Lazarus without gdb, there is an option in Lazarus 1.8 to run without any debugger. Obviously you then won't have a debugger but if you write better code than me you may get away with it.

Incidentally, I had little trouble installing gdb on Sierra, is the issue you want to avoid specific to High Sierra ?

Anyway, having Lazarus installed just to do the editing of source and GUI would be a very good idea IMHO. Even if you want to save and then compile (and run) from command line that should work OK too.

Davo
« Last Edit: February 28, 2018, 04:47:51 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

heejit

  • Full Member
  • ***
  • Posts: 245
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #11 on: February 28, 2018, 07:55:58 am »
You can check the examples project comes with Lazarus some gui created in code only like notebk.lpi

or try fpGUI
« Last Edit: February 28, 2018, 07:58:30 am by jshah »

gop

  • Newbie
  • Posts: 6
Re: How to create GUI applications in macos High Sierra without Lazarus
« Reply #12 on: February 28, 2018, 12:04:46 pm »
Thank all of your for your replies.

 

TinyPortal © 2005-2018