Recent

Author Topic: Another Newbie Question – In the Text Editor Realm (Runtime Errors)  (Read 2514 times)

MrPink

  • New Member
  • *
  • Posts: 15
Just checking in; having been forum-dormant since mid-June. I downloaded Lazarus, but am still operating in my old comfort of the text-based editor. I have a coding project that requires completion by end August, so my nimble remedy is to stay with what I know. I will one-day immerse myself in the Lazarus; just not now.

Having just jumped back into the coding after many years, I’m actually rolling back to ask about an old operating bugaboo of mine -- something that literally “freezes” me during the process. A fear I don’t cope-well with, and have never overcome.

Runtime Errors! Out of that fear, I keep my coding cycle short. Add or subtract something. Compile. Run. Repeat. When they show up, my fatal errors are usually 201; sometimes 207. That’s when the proverbial freeze happens, as my inserted flaw over the last 10-15 minutes could be lurking virtually anywhere in the code. A stray comment bracket? A misguided added variable? A misplaced semicolon? I have no idea!

Mostly I get time-span lucky in remembering what I just did (80%). I correct and move on. When stumped though, I rollback to a previously-saved file and start anew with the safe code therein. The rollback evokes frustrated dumb-ass feelings, but it gets me saved; new life in moving on.

It is quite possible that I missed “that particular class” when learning the language back in 1984. Per chance, is there a reasonable (maybe easy) remedy to my occasional emotional distress?
Thanks,
MrPink

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10546
  • Debugger - SynEdit - and more
    • wiki
Well, there isn't much of an answer that goes with your "stay with what you know - a text editor". At least I don't have any helpful suggestion for that.

Actually, staying with the text editor, but introducing git (or similar). Well, yes actually more to learn that switching to an IDE. But I just mention it anyway. Commit after each successful run. Then you have an exact diff what you changed since. That may help.
Of course, you can back up each time, and do a diff to the backup folder.
It still leaves a lot of work.

Ideally, at least run from within the IDE, inside the debugger, because it shows you the line on which the runtime error happened => that is most of the time really useful. (You do need to setup project to load ...)

Well, maybe the last one stays within your self prescribed bounds:
You can try compiling with  -gl   => if you are lucky it will print a useful trace of the location of the runtime error. Not sure... You need to compile for console, and run with console.

440bx

  • Hero Member
  • *****
  • Posts: 4727
Mr Pink, I can relate to your editor preference.  I don't know what editor you use but, if it supports saving the modified files when it loses focus (that is, the user is switching to another app), Lazarus automatically detects if any file it is editing has changed and asks you if you want to reload them (to which you normally approve.)

IOW, you can edit the same file in your editor and in the Lazarus editor at the same time (I know because that's how I do it, I always have the files open in Lazarus editors and in my preferred editor.)

As Martin mentioned, having your program loaded in Lazarus and executed from Lazarus will give you the assistance of the Lazarus debugger.  With the Lazarus debugger, finding runtime errors often only takes a few seconds.

Bottom line is this: your fear of runtime errors is preventing you from using the tools that would make short work of eliminating them. 

Since now you know you can edit using your editor and Lazarus at the same time, you can have your cake and it eat too.

However, a word of caution is in order, if your editor cannot be configured to save files when it loses focus then having that editor and the Lazarus editor simultaneously editing the same file is a recipe for trouble because the editors won't see the file has been modified, resulting in lost edits.

Unfortunately, TTBOMK, Lazarus does not have the option of saving files when it loses focus, that has occasionally caused me to lose some edits, fortunately nothing ever major but, it's something to pay attention to, always save the file before switching back to your editor which hopefully checks the last time the file was modified when it regains the focus and reloads the file automatically.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 559
I don't really understand your issue or what editor/system you're using, but for my money a few hours learning your way around the Lazarus IDE is a terrific investment even if you're only interested in text-mode programming. 

In that direction, it might be helpful to check out this short video:

https://www.youtube.com/watch?v=Y64hkbPU-ek

This from the following with lots of other information here might be helpful for you:

 https://wiki.freepascal.org/Lazarus_Documentation#Free_Pascal_Compiler_Documentation
« Last Edit: July 19, 2024, 12:20:19 am by Curt Carpenter »

440bx

  • Hero Member
  • *****
  • Posts: 4727
what editor/system you're using
Before anything, I agree that he should invest some time and effort in becoming familiar with Lazarus.  It would serve him well.

That said, I find the editors available today to range from tolerable at best to intellectual torture devices, truly genuinely, an intellectual inquisition, e.g, the VS editor, what a disgrace!!

Someone reading this may wonder what editor I consider good, which would be a fair question.  About 30 years ago, I used a Wang word processor (not for programming, of course), this was a dedicated word processing machine, today it is a relic, a true clunker but, when it comes to being a lean mean text editing machine, that old relic is yet to be _remotely_ matched.  A few years later, I found an editor that came reasonably close to the power, simplicity and flexibility of that Wang and, I have been using that editor ever since (for the record, it's the now defunct, Multi-Edit.)

When I use any other editor, my productivity takes a 10 fold hit and that may very well be an understatement.  The VS editor is simply insufferable and, most editors I've looked at get a reaction "you call that an editor ??????... you've got to be kidding!!!"

I don't know what editor he is using but, he has probably become proficient with it and switching to another editor means a significant drop in productivity.   I don't envy him because he is between a rock and hard place.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1200
@mrpink I'm sorry pascal programming is so scary, would you like me to hold your hand?  :D

@440bx does fpc come with an editor that allows debugging? I've only. used lazarus ide.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

dseligo

  • Hero Member
  • *****
  • Posts: 1406
@440bx does fpc come with an editor that allows debugging? I've only. used lazarus ide.

You can debug in Free Pascal IDE.

440bx

  • Hero Member
  • *****
  • Posts: 4727
@440bx does fpc come with an editor that allows debugging? I've only. used lazarus ide.
dseligo answered the question, which I am glad he did (thank you) because I don't remember much about the Free Pascal text mode IDE (I never use it.)

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1200
@440bx does fpc come with an editor that allows debugging? I've only. used lazarus ide.

You can debug in Free Pascal IDE.
Is it possible to develop gui programs using fpc without Lazarus or it is strictly for console programs?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

440bx

  • Hero Member
  • *****
  • Posts: 4727
Is it possible to develop gui programs using fpc without Lazarus or it is strictly for console programs?
It most certainly is. 

None of my programs, GUI or otherwise, use any of the Lazarus components.  Many of my programs compile with FPC and Delphi v2 (yes, that's right, version 2.)  All I need is an editor and FPC.  That said, IMO, a debugger is as important a tool as a good compiler and a good editor and, now Lazarus offers a really good debugger (FpDebug).  I use Lazarus as a front end to FPC and as a debugger and, very minor editing (I do all the real editing in a separate editor.)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5375
  • My goal: build my own game engine using Lazarus
Re: Another Newbie Question – In the Text Editor Realm (Runtime Errors)
« Reply #10 on: July 19, 2024, 03:55:13 pm »
Yes, we can develop GUI programs using FPC directly without Lazarus. For most cases using Lazarus will be easier especially for beginners.

This link show how jc99 and Thaddy do text displaying using FPC:
https://forum.lazarus.freepascal.org/index.php/topic,37425.msg251456.html#msg251456

And this is how to display a picture in console mode by 440bx:
https://forum.lazarus.freepascal.org/index.php/topic,49583.msg359879.html#msg359879

I prefer Lazarus, because this IDE has many features I like. But even I use Lazarus, most of the GUI components I generate them using code. This is very important, for me. I frequently revise my programs, I can search/edit/replace any item I like easily because they are typed in the source code. It will take more steps and time if they are configured using Lazarus' Object Inspector. I heard there is an IDE that has capability to search/edit/replace into their object inspector, something like that. Unfortunately, Lazarus doesn't have it.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8007
Re: Another Newbie Question – In the Text Editor Realm (Runtime Errors)
« Reply #11 on: July 19, 2024, 03:57:52 pm »
Is it possible to develop gui programs using fpc without Lazarus or it is strictly for console programs?

Do you remember the question of a couple of days ago about how to extract the commandline passed to FPC by the Lazarus IDE? That should answer this one: when it comes to compilation all the work is done by FPC although using the IDE or Lazbuild makes it very much easier.

Having said that, there are some aspects of building a graphical application (form editing, processing of resource files and so on) which are made /vastly/ easier by the Lazarus IDE or some equivalent. I predate such things but have embraced them with enthusiasm, so I wot of which I speak.

So to summarise: sure you can build a GUI-oriented app without Lazarus. You can also build a house by starting off by building a furnace, using that to smelt iron and refine steel for a saw blade, cutting trees for beams and boards, firing your own bricks... and even then finding you've got to cooperate with somebody else to get slate or reeds for the roof since none are available on your own land.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10546
  • Debugger - SynEdit - and more
    • wiki
Re: Another Newbie Question – In the Text Editor Realm (Runtime Errors)
« Reply #12 on: July 19, 2024, 04:05:23 pm »
Is it possible to develop gui programs using fpc without Lazarus or it is strictly for console programs?

Yes, and there are more than one way to do that.

For starters there are FpGUI and MSE-IDE/GUI => both are alternatives to Lazarus.

But you can also develop GUI apps from scratch. Just make direct calls to the WIN-API, Gtk-API, X-Server/Wayland or whatever your System has.


Scoops

  • Full Member
  • ***
  • Posts: 103
Re: Another Newbie Question – In the Text Editor Realm (Runtime Errors)
« Reply #13 on: July 19, 2024, 04:12:19 pm »
I suppose we could also add.
Using the LCL without Lazarus.
https://wiki.freepascal.org/Using_the_LCL_without_Lazarus
« Last Edit: July 19, 2024, 04:18:36 pm by Scoops »

MarkMLl

  • Hero Member
  • *****
  • Posts: 8007
Re: Another Newbie Question – In the Text Editor Realm (Runtime Errors)
« Reply #14 on: July 19, 2024, 04:56:54 pm »
Also anything related to FreeVision https://wiki.freepascal.org/Free_Vision

I archived a simple editor for that after getting the OK from its original author https://github.com/MarkMLl/Dialedit3b and I think that somebody's done a bit of work on it since (link, anybody?). Nowhere near as good as MS Visual Basic for DOS though.

And going back to OP, /none/ of these are as polished as using the Lazarus IDE: for which we owe thanks to Martin et al.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018