* * *

Author Topic: free pascal (none-lazarus) help  (Read 1399 times)

pielago

  • Newbie
  • Posts: 4
free pascal (none-lazarus) help
« on: April 25, 2018, 03:02:20 am »
Not sure if this is where to write my question? but here we go!
a month ago I downloaded free pascal from the website in to my mac 64bit and also added the IDE that the site recommend all was perfect i was able to create a folder add my project.pas and display the hello world in my terminal  however I'm using lightweight-IDE 1.0a10 and NOT! lazarus IDE also did many tutorials from site and wiki  to terminal and in a month i feel I'm getting it and ready for the next step which is  making a simple hello world APP but the pascal site and its contents point to lazarus in this case I'm confuse? is it possible to do what lazarus does? just by using the pascal and that IDE? or do i need to add more to the folder or add plug-ins? I tried to do a frame using lazarus code and it crashed !can anybody help me or direct me on what to do to achieve making a hello world frame with a simple button ?

P.S i really don't like the lazarus IDE and love the lightweight-IDE 1.0a10 i'm more like terminal user versus GUI user.
Hope someone HELP me!

Phil

  • Hero Member
  • *****
  • Posts: 2749
Re: free pascal (none-lazarus) help
« Reply #1 on: April 25, 2018, 03:25:42 am »
is it possible to do what lazarus does? just by using the pascal and that IDE?

You're kinda all over the place and I'm not entirely certain that I understand what you're asking, but I _think_ you're asking whether it's possible to create a GUI app entirely in code, without using a UI designer like what Lazarus and Xcode include. I'm not familiar with Lightweight-IDE, but I assume you're referring to this and that it does not have a UI designer:

http://www.ragnemalm.se/lightweight

If so, search this forum for questions about creating forms and controls at runtime in code.

The question is whether you'll succeed at that. With desktop software development, programmers have been using UI designers for quite a few years, although this is uncommon in, say, Web app development, probably because Web apps are not designed like desktop apps with fixed UI widget positions and layouts.

With a UI designer, you can lay out your widgets in the design phase, before you compile, thereby saving a lot of edit/compile/run cycles.

One approach you might take would be to follow the normal Lazarus or Xcode path, designing your UI the conventional way with the provided designer, but then do all your code editing and building in whatever IDE or text editor combo you prefer. For example, I'm not a fan of the Lazarus code editor, so I never use it, preferring BBEdit for all my editing needs on Mac (https://www.barebones.com).

Xcode info for Pascal is here under ProjectXC:

https://macpgmr.github.io

dbannon

  • Sr. Member
  • ****
  • Posts: 290
Re: free pascal (none-lazarus) help
« Reply #2 on: April 25, 2018, 03:28:31 am »
Pielago, I have never used the "lightweight" IDE but understand its similar to the original Turbo Pascal IDE ? I have used that, now you know how old I am !

If all you want to make is text based applications, ones you start from the terminal and they display their output on the terminal, yep, stick with that. Its probably possible to make a text character GUI like application but hard and quite unsatisfactory IMHO.

If you want nice buttons to press and windows that look and feel like your main Mac interface, I suggest you need to use Lazarus. It includes a means to edit the layout of your GUI interface as well as a nice code editor and you need both.

All those nice GUI components are provided by the LCL. It might be possible to build an application on the lightweight IDE that uses the LCL but it would be very hard work. I would not recommend it ! 

 Davo

Lazarus 1.8, Linux (and reluctantly Win10, OSX)

Handoko

  • Hero Member
  • *****
  • Posts: 2443
  • My goal: build my own game engine using Lazarus
Re: free pascal (none-lazarus) help
« Reply #3 on: April 25, 2018, 04:55:53 am »
... is it possible to do what lazarus does? just by using the pascal and that IDE? or do i need to add more to the folder or add plug-ins?

Basically, Lazarus is an IDE + GUI designer. You can create programs that give the same result as Lazarus does, only by using FPC + other IDE. But as a GUI tool, Lazarus offers many features for designing GUI applications, like drag and dropping new components, positioning, resizing, setting tab orders, etc.

Without using Lazarus, you will have to manually modify the values in the .lfm files or create object dynamically on runtime. That won't be easy. Other IDEs may have the ability as a GUI designer but because implementing/integrating this feature is not easy, I don't think lightweight-IDE has this feature.

I tried to do a frame using lazarus code and it crashed !can anybody help me or direct me on what to do to achieve making a hello world frame with a simple button ?

Thaddy and jc99 have good examples for creating form and showing message without using Lazarus:
http://forum.lazarus.freepascal.org/index.php/topic,37425.msg251446.html#msg251446

pielago

  • Newbie
  • Posts: 4
Re: free pascal (none-lazarus) help
« Reply #4 on: April 25, 2018, 11:14:40 pm »
thanks Guys for the info well i found a tutorial of a simple frame
sorry for confusing ya i was also confuse and was not sure how to explain it!
here it's what i found and can you guys detail me this code
where to find this package in free pascal? to find more (macOSALL)is it in (LCL)

once again thanks for the quick reply  :)


Code: Pascal  [Select]
  1. // Minimal demo. It is hard to make a graphical program smaller.
  2. // Good starting point for graphics hacks with QD.
  3. // See minimalCG for a version that creates a CG context!
  4. // By Ingemar Ragnemalm 2008/2009
  5. //QuickDraw or Core Graphics,Carbon demos,Cocoa versions, in Objective-C,Objective-Pascal
  6.  

Code: Pascal  [Select]
  1. program frame1;
  2. uses
  3.         MacOSAll;
  4.                
  5. var
  6.         window: WindowPtr;
  7.         r: Rect;
  8.         err: OSStatus;
  9. begin
  10.         SetRect(r, 100, 100, 500, 500);
  11.         err := CreateNewWindow ( kDocumentWindowClass, kWindowStandardDocumentAttributes, r, window);
  12.         SetWTitle(window, 'Minimal');
  13.         InstallStandardEventHandler(GetWindowEventTarget(window));
  14.        
  15.     ShowWindow(window);
  16.     SetPortWindowPort(window);
  17.    
  18.        
  19.     // Call the event loop
  20.     RunApplicationEventLoop;
  21. end.
  22.  
  23.  

Phil

  • Hero Member
  • *****
  • Posts: 2749
Re: free pascal (none-lazarus) help
« Reply #5 on: April 25, 2018, 11:25:32 pm »
thanks Guys for the info well i found a tutorial of a simple frame
sorry for confusing ya i was also confuse and was not sure how to explain it!
here it's what i found and can you guys detail me this code
where to find this package in free pascal? to find more (macOSALL)is it in (LCL)

That's the ancient Carbon framework you're using there. Carbon is limited to 32-bits and won't be around much longer on Mac, so I don't know how useful studying it would be. I would at least move to Cocoa. Interface to Carbon (MacOSAll) and Cocoa (CocoaAll) are both part of FPC and have nothing to do with Lazarus per se.

Note that you can do the same in Laz by setting a new app's default form's dimensions to what you use there - all without code (what a concept). And your code would work on Windows and Linux too.

pielago

  • Newbie
  • Posts: 4
Re: free pascal (none-lazarus) help
« Reply #6 on: April 26, 2018, 02:20:09 am »
Quote
I would at least move to Cocoa. Interface to Carbon (MacOSAll) and Cocoa (CocoaAll) are both part of FPC and have nothing to do with Lazarus per se.

thanks good info so what i need is to dig in to fpc and find the cocoaAll and carbon to get source codes to get started?
any links? that you might know so i can start reading and practicing???

CCRDude

  • Sr. Member
  • ****
  • Posts: 355
Re: free pascal (none-lazarus) help
« Reply #7 on: April 26, 2018, 07:44:51 am »
I've been down that road with Turbo Pascal for Windows, with Symbian, with FreePascal for WinCE and with FreePascal for iOS.
Neither project survived for long (the OS will change, every small update needs research instead of just depending on a trusted framework).

If you want to get down that level, you need to reinvent every wheel every time, instead of having the wheel reinvented once for the framework, with everyone benefiting.

If you want to go that road, I would suggest that you simply spend some days looking at Objective-C examples that do the same, then port them to FreePascal. Simply google for "cocoa app without xcode" and you'll get a bunch of examples:

https://www.cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
http://glampert.com/2012/11-29/osx-window-without-xcode-and-ib/

Doing some XCode tutorials upfront would help though, to get a feeling for what controllers and views are, for example.

pielago

  • Newbie
  • Posts: 4
Re: free pascal (none-lazarus) help
« Reply #8 on: April 26, 2018, 04:02:34 pm »
thanks so much
this is what i was looking for! information i will for sure start asap searching for Objective-C examples to understand the method to do apps without the lazarus  also i read that (free-pascal SDL2) can do apps and/or games. not sure if true? but for now what ever info is welcome and thanks to all for great replies...

any other tips ..will be appreciate it.. 8-)

Phil

  • Hero Member
  • *****
  • Posts: 2749
Re: free pascal (none-lazarus) help
« Reply #9 on: April 26, 2018, 04:06:12 pm »
thanks so much
this is what i was looking for! information i will for sure start asap searching for Objective-C examples to understand the method to do apps without the lazarus

I already pointed to this page. See if you can complete the simple example - in Xcode, with Pascal, no Lazarus.

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

Handoko

  • Hero Member
  • *****
  • Posts: 2443
  • My goal: build my own game engine using Lazarus
Re: free pascal (none-lazarus) help
« Reply #10 on: April 26, 2018, 04:58:24 pm »
i read that (free-pascal SDL2) can do apps and/or games. not sure if true?

Yes, you can. A kid after learning Pascal for some weeks, he built a simple game called DinoLand just using Free Pascal + SDL:
http://forum.lazarus.freepascal.org/index.php/topic,34013.msg221868.html#msg221868

Someone using Free Pascal + SimpleZGL created StarfieldShooter:
http://forum.lazarus.freepascal.org/index.php/topic,35313.msg252262.html#msg252262

Using Free Pascal + Allegro.pas, I created Furious Paladin:
http://forum.lazarus.freepascal.org/index.php/topic,35313.msg254588.html#msg254588
The source code can be found here:
http://forum.lazarus.freepascal.org/index.php/topic,35313.msg270638.html#msg270638

Using Free Pascal + libraries, you can create lots of program.

I can understand Lazarus IDE can be a bit not convenient for newbies. But if you know how to configure it properly, it really has many features that help programmer handle complex projects easily. For example:

An experienced programmer, using Lazarus + SDL2 created a Lazarus tool for Android app development, unfortunately he does not continue his effort:
http://forum.lazarus.freepascal.org/index.php/topic,33008.0.html

And LAMW (Lazarus Android Module Wizard) is an Android app development tool created using Lazarus and for Lazarus:
http://wiki.freepascal.org/LAMW

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus