Hello world/Newbie: Difference between revisions

no edit summary
No edit summary
Line 811:
The program should produce the following output:
<pre>Hello world!</pre>
 
The following instructions apply to any version of Delphi going back to the 1990's. They also apply to Lazurus, which is a Delphi-like programming environment based on Free Pascal.
 
1. You should install Delphi or Lazarus on your computer. Delphi installation disks will automatically install the program and all necessary libraries, editors and tools on your computer. Lararus installion files can be downloaded from their web site. They will also install all necessary tools.
 
https://www.lazarus-ide.org/
 
2. Once Delphi/Lazarus has been installed, choose the "File -> New" option from menu bar. Next choose "Application" or "VCL Forms Application" depending on which language or version you are using.
 
This will cause the program to display a blank window called a "Form", with a grid of dots. The dots indicate that the program is in "Design Mode" and it is ready for you to design a GUI interface for your program.
 
3. At the top of the IDE is a "Component Palette" that displays a bunch of icons. Each icon is an object that you can put on the form.
 
Select the "Memo" item by clicking on it once. (It is normally the sixth item from the left.) Now click on the form; a white box should appear. This is an object that allows you to display, enter and edit text. You can move and resize the memo, by dragging the control with the mouse or pulling on the tiny black boxes on the edges of object.
 
Next click on the "Button" object on the palette and drop it on the form next to the memo. It can also be moved or sized.
 
4. Double click on the button. This will automatically write a subroutine in the source code and bring up the Delphi/Lazarus source-code editor displaying the subroutine.
 
procedure TForm1.Button1Click(Sender: TObject);
begin
end;
 
Between "begin" and "end" statements, enter the following line of code:
 
Memo1.Lines.Add('Hello World');
 
The end result should look like this:
 
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add('Hello World');
end;
 
5. You've now completed the program. Press the "Run" button in the upper left portion of the IDE. (It is usually the button with green arrow on it.) The program will now display your form with the button and the memo on it. Press your button. This will cause the "Hello World" to be displayed in the memo.
 
 
=={{header|EasyLang}}==
465

edits