Forum > Beginners

Please Explain how Forms and Units Integrate

<< < (2/2)

theo:
Pascal is not case sensitive.
You should not call your program "News" and a unit it uses "news".
That is why you get the error message:
News.lpr(11,35) Error: Duplicate identifier "NEWS"

Ñuño_Martínez:

--- Quote from: flywire on February 05, 2015, 11:54:48 am ---What is the best way to work through the program (in procedural terms from beginning to end)?

--- End quote ---
As people said before, Pascal programs starts on the PROGRAM file (extension ".lpr" on Linux, ".pas" or ".pp" on FreePascal, ".dpr" on Delphi).  It starts at "BEGIN" and ends at "END." (note the period).  But units may have "INITIALIZATION" and "FINALIZATION" sections that will be executed before and after proper PROGRAM.

Note that Lazarus graphical applications aren't procedural, but multi-thread event driven applications.  So, in most cases you will not see any call to any TForm object.  So trying to follow the application flow will be useless in most cases.

You should take a look to the Lazarus Wiki.

flywire:

--- Quote from: Ñuño_Martínez on February 19, 2015, 11:53:57 am ---... Note that Lazarus graphical applications aren't procedural, but multi-thread event driven applications. So, in most cases you will not see any call to any TForm object.  So trying to follow the application flow will be useless in most cases. ...
--- End quote ---

If you need to work with a program then you need to understand how it works and it [can be] fairly easy with a procedural program. So how do you go about understanding code for an object oriented program? I realise that one approach is to just look at the forms and examine those bits of the code that you need to while accepting that the rest exist. Still, you need to understand those bits used throughout the application.

typo:
You could see a form as a multi-input machine where only one action (because of the mouse pointer) is available at a time. The flow is not controled by the programmer, but by the user. So the programmer puts event handlers attached on each input point which will make the program work as the user expects -- just like a machine.

When an input point is activated, the event handler attached to it is executed.

Navigation

[0] Message Index

[*] Previous page

Go to full version