Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delphi Beginner tutorial
07-07-2009, 02:38 PM (This post was last modified: 10-01-2009 09:27 PM by drdebcol.)
Post: #1
Delphi Beginner tutorial
Delphi Tutorial For New peoples ^^ don't worry i'm nice
NOTE:
this is not for people who already know delphi this is for people who are just starting Delphi and are having a hard time or
are just starting Delphi all-together

haha ok so I'm guessing since you are taking the time to read this you want to learn Delphi

Well then I'm going to start off with the complete basics

Delphi is a language Derived from Pascal which if you haven't noticed gives it some of it's nick names
i.e

Object Pascal
Visual Pascal
etc...

Delphi has something called a VCL( visual component Library )
same with Visual Basic But Delphi is alot more powerful and has more options/Buttons/every thing you need

Ok on to Delphi
I'm assuming you already have one of the Delphi IDE's installed if you do not pm me

as you open Delphi if you have Delphi 6 or 7 a GUI is already created for you so thats all you need to start
On The Top Tabs you see multiple Buttons Sockets etc On THe Left you have something called the " Object Inspector "
you will need this and you will depend on this heavily of the top left you see something called the " Object TreeView "
you will Not need this for this tutorial

OK onto the code section it should be right behind your blank GUI form
Delphi isn't just drag and drop you actually have to code things in order to make a good application

ok The Classic generic but always Helpful 'Hello World':

Drag A Button Onto The Form ( or just double click it )
It should be under The Standard Tab with OK written on it that is our button


Alright Remember that object Inspector? Now we are goin to use it find something named " Caption "
then change it to whatever you like As you will see it immediately shows up on the button
Now for the code that makes the button work double click on the button that should bring you to the " Code"
you should see something like this
Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

end;

end.

That is the skeleton Of A Delphi Program
of now in between the
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
And
Code:
end;

Type the following or anything you'd like as long as it's coded like this

Code:
ShowMessage('<Your Message Here>');
so when you run the application by using the green play arrow it should display your message of choice

Now since that is done and out of the way lets work with some visual components that are really fun to play with
I'll Explain how to use the 2 following components
1)Main Menu
2) Memo




1)The Main Menu Under The Standard Tab once again when you place it on the form you should see it but when
you run your application it will be invisible this is a non visual component ok now how to use it just double
click it and it should bring up a menu-list editor you can place captions on these how you like but when you
run your application you get a full menu now lets get to some of the commands here are the basics:
Create a tab name it what you like then make another tab under that we'll name that Close
double-Click on the close Tab and obviously this will show you how to Close The Current Application Running

ok once you are at the code segment type the following

Code:
Close;
Confusing Right!!

and that basically closes the application you can also change the Caption of the form by using the main menu make
another tab name chang or whatever you would like go to the code segment of the change the caption tab and type this in
Code:
Form1.Caption := (' < Message Of Your Choosing >');
and when you click on the main menu tab it changes your application's title ^^ simple stuff here

Now for the memo this is like a little drag and drop notepad it comes with about everything it auto-scrolls
etc...
Now lets learn how to use it
As usual under the standard tab it looks like the little sheet of paper with the lines on it
When you put this memo onto your form it should have written on it Memo1 to remove this go to that Object Inspector i was
talking about earlier Find the " Lines" click on it then a button with three periods should appear
Click on that and it should bring you to a string editor just take out what you want and put what you want in
here is an alternative way to clear a memo double click on the form the enter in this
Code:
Memo1.Clear;
that just tells Delphi to clear memo1 basically explains it self
Now how to add lines to a memo put a button
and add this to it
Code:
memo1.Lines.Add (' Lol');
so at the end it should look something like this
Code:
procedure TForm1.Button2Click(Sender: TObject);
begin
  memo1.Lines.Add ('hi');
end;
And thats it for this basic tutorial if you need any help hit me up at:
backtrackv4@hotmail.com

Did any one notice the 30+ Delphi books i posted


http://www.pro9ramming.com/showthread.php?tid=143

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
07-07-2009, 05:04 PM
Post: #2
RE: Delphi Beginner tutorial
Yeah, good tut for beginners, maybe it would be better to post some images, but it is great !

There's a fine line between genius and insanity. I have erased this line.
Oscar Levant
There's a fine line between an administrator and black hat hacker. I have erased this line.
Dr DEBCOL
Visit this user's website Find all posts by this user
Quote this message in a reply
01-08-2010, 07:55 PM
Post: #3
RE: Delphi Beginner tutorial
Yes! Really nice Tut
thank you
Find all posts by this user
Quote this message in a reply
01-08-2010, 08:02 PM
Post: #4
RE: Delphi Beginner tutorial
(01-08-2010 07:55 PM)bl4ck.b4nd Wrote:  Yes! Really nice Tut
thank you

Glad to Help Big Grin

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
01-09-2010, 12:43 AM
Post: #5
RE: Delphi Beginner tutorial
I'm going to start delphi in just a few days,and i'm going to take time in this topic,and i'm going to ask you,Lol.as otoom always say,so yeah!
thanks for starting this topic

Gholamreza Takhti
who was he? find out
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: