Posted on

The Interface Of Lazarus IDE – Simplified!

The Interface Of Lazarus IDE

The Interface of Lazarus IDE. It has a clean interface. Which is what we are discussing in this post. Today i will identify the main parts of the GUI or interface screen. And go in a slight detail on what does what. The GUI of Lazarus can be different depending on what app you are making.

For example, in older examples. We used the Program application. But if we try to use the Application type. The GUI will include 1 more menu, The Form. Below i’ll explain what each part of the menu is. Let’s Begin!

The Interface Of Lazarus IDE – Details

The Tool Bar – Your Main Screen

The ToolBar Of The Lazarus IDE

Above is a image of the Lazarus IDE Toolbar. Here we can see the basic File , Edit , Search menu and so on. Under the File button is another section. Which allows us to make new projects, Run existing projects with or without debugging. And much more. The important part of this toolbar is the menus which say Standard, Additional and so on.

These menus contain “Components”. We use the components in the Application program type. We can also drag and drop these components on a menu called Form.

The Form – Our Place To Build

The Basic Unit Of Building A Program – A Form

Above is a image of a form. A Form is where we can drag and drop components to make software of varying types. Such as in the Standard menu of the toolbar there is a component called “TButton”. If you drag and drop it on the form.. what we get is a button on the form! Congratulations. That’s your first component placed.

Although the button has taken it’s place, it is pressable meaning you can click on it and it will get pressed. But the problem is, currently it is just a button. Nothing more. It will do nothing when clicked on. To write the code for making this button work, double click the button.

A new menu will open for us, The Source Editor.

The Source Editor – Where Magic Happens!

The Source Editor – where the code is written and brought to life!

Let me explain, when we clicked the button the computer made a “Event”. An event is an action. For example clicking a button triggers an event and once an event gets triggered. It runs the code written inside of it.

There are many ways to trigger events. And there are different types of events too. But for now let’s keep the event “Button1Click” in mind. Just below the line which says “procedure TForm1.Button1Click”. You can see that there is a begin and end written here.

To write code and make it work, we must write the code between the begin and end. Begin signals that the code starts from here. End signals that the code ends from here. The semicolon at the last part of “end” is important. As the computer will not register the end until we place a semicolon.

Now while for now double clicking on the button to access the component is what we did. Imagine having a software like say a windows installer. It will have many components and it’s kinda bothersome to have to double click on it to access it. And even if accessing it is not a problem how do we change stuff like say the text written on the button? or Change events???

For all this a 3rd menu opens for us – The Object Inspector

The Object Inspector – The Game Changer!

The Interface Of Lazarus IDE
A View Of The Object Inspector

This is also an important menu of Lazarus. In here we can mess with changing events, change the color of components, change whats written on them and much more. We can also align the components in the center or corners or sides or wherever!

The Messages – All Our Alerts!

The Message Menu When You Run Code!

This is another vital menu of Lazarus. When writing code if you make a mistake, it alerts you. It also shows you basically the whole log of Lazarus. Whats being compiled where, which variables are not being used. Which line number is the error of code in and so on. For information reasons this is very useful.

In case your software was to crash this menu will show reasons why, how and when. As well as how to fix! Although it’s method of showing how to fix errors is not that good but it’s decent enough to have you know what to do.

Conclusion

Combining the usage of this, and the above mentioned menus is important. If used together all of them mentioned above can be used to make the best software of the world!

For now i won’t explain too much of this but later on as we use them and progress forth. Much will be revealed to you all! So keep reading on and let’s proceed to the next post – Our first few components.

Posted on

What is Lazarus Delphi? Simple and Easy!

What is Lazarus Delphi?

What is a IDE? An IDE stands for Integrated Developer Environment. It is the software that you use to write code within. There are many IDE’s made for different languages.

But for the Pascal language we can use 1 of 2 options.

The first option is the free for all option known as, Lazarus.

The Second Option is the premium software Delphi.

What is Lazarus Delphi? Details Below!

What is Lazarus Delphi?

1 : Lazarus – The Free Option

The motto of Lazarus is “Write once, Compile anywhere.” This IDE, made for the free developers of Pascal has a very simple GUI. (Or Graphical User Interface). With a aresenal of different components to build with. This IDE is a must use for any new programmer of the object Pascal. With a active community by it’s side, the free pascal program has made great progress.

Simple due to the fact that it’s your only free option is the reason why you should use it. We can use Lazarus to create a whole variety of softwares at our disposal. The simplest of them being a calculator. Lazarus is hence a vital tool to use for any beginner to object Pascal.

But for those who are looking for a more advanced experience, Delphi is also a thing!

2 : Delphi – The Place Of Architects

Logo Of Delphi – For Engineers

Delphi – is another IDE that we can use for writing code in Pascal. Developed by the famous company Embarcadero. This software is a key tool to use for any professional software. Unlike Lazarus, this IDE requires the usage of a License which we need to buy from the Embarcadero site.

But, the price is worth it! While in hindsight, both Lazarus and Delphi are the same. Delphi offers some subtle and yet simple changes that Lazarus could also use. But in conclusion, they are both the same. So choose whichever one you feel fancy with and get coding!

IDE’s For Other Languages

Now Pascal has it’s IDE’s of course. But just like Pascal all languages have their own IDE’s. These are designed to make coding with that language easier and simpler.

For example, to code in python Pycharm is a often used IDE. For the weaker languages like HTML, CSS and JavaScript Sublime Text is also a good IDE. There are many IDE’s in the world coming and going. Keeping track of them and knowing which to use is essential for a developer.

Installing Lazarus

Lazarus being the free IDE. It is rather easy to install and is what i will be using most of the time. As for how to install it it’s simple. But first i’ll have to clear out a point.

And that is the fact that for code to run you need to compile it. Compiling basically means to package the code for running. It sounds complicated and all but all the compiling work is the business of the IDE not us!

Lazarus comes with a built in compiler called FPC or Free Pascal Compiler. The compiler is what Lazarus uses to run code. The developers of the Pascal community have worked together. To give us the software known as FPCUpDeluxe. This software was made so that we can install FPC and Lazarus for different operating systems. And even different versions of the software on the same system!

This is what grants Lazarus it’s flexibility over code. We shall use the FPCUpDeluxe software to install Lazarus. And lucky for all of us, it’s simple!

Step 1 – Downloading FPCUpDeluxe

Simply search on google “FPCUpDeluxe” or use this link to access the github post for FPCUpDeluxe’s latest version. The link is as follows:

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases.

Step 2 – Installing FPCUpDeluxe

It is highly recommend to put the installer of this software within it’s own folder. Because this software upon launching will make some important files that become hard to move later on. So have a folder prepared for it beforehand!

Once done simply double click the application and the FPCUpDeluxe software should be ready for use.

Step 3 – Installing Lazarus With FPCUpDeluxe

Once FPCUpDeluxe is started and ready to run. Simply choose what Operating System and what version of the compiler and Lazarus you want. By default the compiler will have already chosen the best possible settings so you can go ahead and click the button on the bottom right. Which says “Install/Update FPC + Laz” or something like that.

Step 4 – The Waiting Process

Now sit back and get a drink cause this software is now installing Lazarus and the free pascal compiler on your device. Note that this software is installing every bit of code within Lazarus automatically so you do not have to do it. So naturally it’ll take it’s fair time but once done you are ready to use Lazarus!

Posted on

What is Variable in Programming? Easy Answer!

What is Variable in Programming?

Finally the answer to the question you all wanted to ask me before. What is variable in Programming?. I mentioned before. A Variable is the basic storage unit of almost any coding language there exists. As told above it’s also a important part of Pascal. Variables are super simple to use and need less effort to activate. Still they are very powerful. I’ll explain more below.

As mentioned above variables are not only used within Pascal. But also other coding languages. These data types are what the computer can store within a Pascal Variable. As mentioned before, Variables have a limit. So storing large values within them will give errors. Below is a reason why it is needed.

Uses And Why It is Powerful

As i mentioned above on why they are important. It’s kinda clear that variables are useful in quite a few regards. If you recall previous examples of posts where i show the usage of data types. In most examples i used a variable.

Their ability to store and use data is what shows their true power. Labelling Variables makes calling them a bit easier. I’ll show it with a example below.

Examples Of Variables

An easy example we can take from older posts. Let’s take the example of calling a string.

What is Variable in Programming?

The example shown above is a simple one. Advanced data types call for advanced usage of variables. Which we can discuss at some future post. As mentioned above, variables are very important. Play around with the code a bit. For more, you can also attend this video from SchoolFreeWare on the subject of Variables.

If that example made less sense and this video did not help for some reason. Worry not! the reason i made this was to learn properly. Not to just look at it and call it a day. We will discuss it in far far more detail in the upcoming posts. Just keep the basics in mind. Eventually you might see coding to make more sense than your national language! And that will be funny.

Posted on

What is a real in Pascal? Simple And Easy!

What is a real in Pascal? A real is another basic data type of Object Pascal. It’s main purpose is to store values inside the Computer as an approximation of a Real number. As real numbers are infinite the computer is unable to represent them. Most of the time the computer will use some other method. Such as using rational expressions to represent Real Numbers. Let’s discuss more below!

Usage Of Real Data Type

The Real Data Type is a powerful data type and kind of a stronger version of the Integer and Float data types. Real can hold can store both Integer and Floating point values. Now here i catch you a bit off guard on the part where i said floating point values. Allow me to explain, A floating point is yet another data type of Pascal.

I’ll go into more detail on it in another post for now keep the basic definiton in mind which is as follows:

A floating point is a data type that can store numbers with decimal places or fractions. A real data type is a powerful data type. It can store whole numbers, real numbers and floating point numbers.

Why Use Integer And Floats If Real Is A Thing???

The computer allocates a specific amount of memory for all data types. For example, Take a Floating point as an example. A float can store decimal numbers as well as whole numbers. As mentioned above it can store decimal numbers. Hence the computer allocates more memory to it as compared to the memory it gives to Integers.

As such using Real or Floats as replacements may cause the computer to use excess memory. Causing significant lag. It may make your entire software crash or worse.

That about explains this i hope. I’ll dedicate a whole post regarding Error finding. And more! So worry not if not now then later you will definetly understand!

Example time!

Example Of Real Data Type

Unlike previous posts the Real data type is rather simple. It is almost the same thing as a integer or a floating point value. Instead a simple example can be something like say “3.4” Or 7/8 and so on. It’s the exact same thing as a integer and float combined.

Keep in mind the warning i gave above. Using wrong data types for what they are not meant for will not assist you. Rather it will slow down your progress most of the time.

I recommend watching this short video. From the SchoolFreeWare Youtube to advance your understanding on the subject.

Posted on

What is boolean in Pascal? Surprisingly Easy!

The General Definiton Of Boolean

What is boolean in Pascal? Booleans are the data types of code which represent the values true or false. This data type is also known for its use in logical operators of circuits. That’s more or less related to engineering. But some people among our community might have heard of the Logical Gates. That’s advanced stuff but if you already know what they are, Boy you and i are gonna get along well!

Usage Of Booleans

Booleans hold the values of True and False as written above. As such we can use them in a variety of circuits and complex codes to make life generally a whole lot easier. A example will soon follow but first we have a few key to define about this data type. Considering the fact its powerful it’s got it’s importance like all other data types.

Limits

1 – It can only hold True and False. No more, No less. Booleans will give errors when given values of numbers, letters or symbols. Anything other than true and false is wrong within the Boolean data type and wil result in errors.

2 – A Boolean is very hard to use on its own. Rather we can use it to add more power to the existing Strings, Integers and Characters. I’ll explain that below with a example real quick, For now keep these 2 points in mind.

Examples To Use Booleans

The following example is what you can use to see the Boolean data type in action. Note that in this example you may or may not understand some part of the code. Worry not as i mentioned in previous posts. I will explain the parts of the code that you don’t understand in a later post. For now Copy and Paste!

Step 1 – Creating A New Program

For this example we use the free Lazarus IDE. Open up Lazarus and create a new program as shown in the Image Below.

What is boolean in pascal?

Step 2 – Choosing A Program

When clicking the New button, Lazarus will give you a whole lot of software options to choose from and make. As is in previous examples we will use the command line Program to keep things simple and elegant. Select Program from the menu that pops up as shown in the Image below.

What is boolean in pascal?

Step 3 – The Code Itself

After choosing Program and clicking OK the IDE will make a brand new place for you to write the code. Copy and paste what i did as shown in the section below, and once done i’ll explain a bit of the code.

var numbers : integer;
var truth : Boolean;
begin
  numbers := 2;
  if numbers = 1 then
  begin
    truth := true;
  writeln('The Program we made told us that if the variable Numbers is equal to 1 then tell us that if its true.');
  end
  else
  writeln('The Program Says That the fact that numbers is equal to 1 is false.');
  writeln;
  writeln;
  writeln('Press <Enter> To Quit The Program');
  readln;
end.

Slight Explanation On Code

The code i used above is simple. I can explain what it did with a simple sentence. I’ll write it in a normal english sentence as written in the below paragraph.

“Hey Computer i’m declaring 2 variables truth and numbers. Truth is a boolean data type and Numbers is a integer data type. Now give Numbers a value of 1. Now if Numbers is 1 then i want you to declare the boolean data type as True and Print on the screen the message i told you.”

That’s that in a nutshell. It’s fine if you do not understand the code i wrote in the above paragraphs. (Although if you did understand what i wrote, Congrats!). I’ll be sure to answer any questions you may have not only in the comments but also in future posts. For now we move on!

Another Way To Learn

To further improve our understanding on Booleans. I recommend watching a video from Youtube. Posted by a well known content creator named SchoolFreeWare. Use this for further understanding the concepts of Pascal!

Be sure to leave a comment if i left out some minor (or greater!) detail. I’ll be sure to fix it as soon as possible. Not gonna lie it’s fun to have you all to journey with! I hope you feel the same. Moving On!

Posted on

What is Char in Pascal? It’s Surprisingly Simple!

What is Char in Pascal?

What is Char in Pascal? Char is a data type of the Pascal Programming Language. As discussed in my older posts. A Character or Char is one of the basic data types that we use in softwares made by Pascal. Char can store ASCII characters. But it’s not needed to store ASCII characters. Rather it can store about any character provided if it’s only one.

What is ASCII?

ASCII stands for “American Standard Code For Information Interchange”.

All code at its pure, every bit of softwares is only 0s and 1s. Which in coding terms we know as Binary. We use ASCII codes to represent text within a computer in the form of binary 0s and 1s.

But for the data type Char we don’t need to use binary 0s and 1s. An example of Char can be something like “A” or “a”. These both will be treated as Characters (provided you call them the right way!). I’ll show it with a example below.

Personal Opinion

In my personal opinion the Char data type might be a bit hard to understand. But all in all as you progress in this course things will begin to make a whole lot of sense! For now let’s practice calling a Character! Keep the next paragraph in mind : 

A data type is a type. To call it we need to give the computer an item and tell it that “Hey this item i gave you is from now on a Character”. We cannot call the type itself and hope that the computer understands it! As mentioned above i’ll give a example in the next paragraph.

.

Example Of Characters or Char

For learning purposes, I’ll show you a simple way to assign a Character to a Variable in the below example. Don’t panic i’ll explain what a variable is in a later post. For now here is how we assign a Variable to the data type Character or Char.

As used in all the previous data type posts. To keep things simple we will use the Lazarus software to write the code. And tell the computer to run that code within the command prompt.

 

Steps Of The Example

Step : 1

Open up Lazarus and on the top right click File. Then click New.

 

What is Integer in Pascal?

After clicking New a menu shall appear with a variety of softwares that can be made with the Lazarus IDE. In this instance..

Step 2 : Choose the Program application type as shown in the image below.

What is Char in Pascal?
This program will run the code in the command prompt as mentioned above.

Step 3 : Write the code! For this instance we shall declare a Variable to the data type Character and tell the Computer to print out the contents of the Variable onto the command prompt.

program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  Classes
  { you can add units after this };
var character : char;
begin
    character := 'B';
    writeln;
    writeln;
    writeln(character);
    writeln('Press <Enter> To Quit!');
    readln;
end.
       


In the Lazarus IDE the first lines which say “uses” or “Classes”. Everything above the line which says “var” is already made for us. So don’t panic on that. Write the code as mentioned above! (You can copy paste it even!).

Step 4 : Run the code! Press F9 on your keyboard in the Lazarus IDE to compile and run the code. The resulting application should be a command prompt. Which says the letter we declared (in this instance B) and the text “Press <Enter> To Quit”.

That is a simple example of Characters Or Char. In the next post i will talk about another data type Booleans. Afterwards once the basics of data types remain taken care of. I’ll explain the Variable thing i did back there. Proceeding on!

Another Way To Learn

As mentioned above, Personally speaking Characters or Char is kinda hard to understand by my perspective. To understand it properly, I recommend not only reading this article but also to watch this video from a famous Youtube channel known as SchoolFreeWare.

Posted on

What is Integer in Pascal? Over Simplified!

What is Integer in Pascal?

Another commonly asked question among the community of Pascal is, “What is Integer in Pascal?” An integer is a Data Type of pascal which can store whole numbers inside it. In an integer, numbers such as 1, 2 , 3 , 4 and 5 and so on can be stored. However, bear in mind that integers can only hold whole numbers.

They cannot hold values such as 1.6 or 1/5 and  so on. Only whole numbers count as such.

Uses Of Integers

As integers can hold whole number values. They are important when it comes to building software related to any sort of calculation. A simple example can be a calculator. A complex example can be the scoreboard (or leaderboard) of a game such as say, Minecraft.

Examples of Integers

Down here i will make a step by step example of integers as well as how to use them. For this purpose we use the Lazarus IDE like the previous example (refer to my post on strings)

The Steps Are As Follows.

Step 1 – Creating A New Program

 Create A New Program by clicking on the File button at the top right corner of the screen in the Lazarus IDE.

What is Integer in Pascal?

Step 2 – Choosing A Program

After clicking the New button, Lazarus will give you a whole lot of options on what kind of applications to build. Navigate your way to Program and click OK.

Step 3 – Writing The Code!

We now have a place to write our code and test it out just like before! Now then, time to write some fancy stuff. Just copy what i do and if you do not understand something, Worry not i shall create more  posts regarding all topics that i know of regarding Pascal.

After all its supposed to be a course, So i will teach you about it soon. For now just copy what i did as shown below.

What is Integer in Pascal? 

Step 4 – Running The Code!

Press F9 on your keyboard, Or Navigate to the top toolbar and click the green play button.

Step 5 – The Finished Result (Good Job!)

The result should look as follows

What is Integer in Pascal? 

Recall step 2. The reason we chose the “Program”  option was so that we could make a simple software. That executes commands within the command prompt to keep things nice and simple. As shown above our code has worked.

What we did was tell the computer this, “Hey computer, Im making a storage area called numbers. I command you to turn it into a integer data type and store the value 12345 in it. Then show it in the Command Prompt.”
If there is anything that i missed out on Integers. Feel free to drop a comment down below, And as for the fact you may not have understood much of my example. Don’t worry it’s there to only show you that integers actually work, I will explain it all in a later post!

Another Way To Learn

As mentioned in an older post, I’ll add a link to a video of a Youtube Channel known as SchoolFreeWare. This channel is amazing at teaching Pascal and can be used to enhance your already existing knowledge of Pascal.