このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Parts of a simple Lazarus 部隊 -lt1Nc.htm HOME - - - - - Lazarus Tutorials TOC - - - - - - Other 構成要素 for programmers
Delicious  Bookmark this on Delicious    Recommend to StumbleUpon

A Lazarus 部隊: 選挙権を持つ/選挙人 parts

This has good (警察などへの)密告,告訴(状), and a search button at the 底(に届く) of the page

Please don't 解任する it because it isn't 十分な of graphics, scripts, cookies, etc!

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a 狭くする window. With most browsers, 圧力(をかける)ing 加える, minus or 無 while the 支配(する)/統制する 重要な (ctrl) is held 負かす/撃墜する will change the texts size. (大きくする, 減ずる, 回復する to default, それぞれ.) (This is more fully explained, and there's another tip, at my 力/強力にする Browsing page.)


In earlier tutorials, we have looked at some simple Lazarus programming. In this tutorial, we are going to look at the general "形態/調整" of the code behind the 使用/適用s. We are going to identify the parts of any Lazarus code.

As was true of the previous tutorials, what you read here is almost the same as what you would read if I wrote the same tutorial for Delphi learners. I'll try to 公式文書,認める differences as we proceed. Please 令状 to me if you find I've failed to 公式文書,認める a Lazarus / Delphi discrepancy.

This is another of the tutorials which is rather dull... but it does 含む/封じ込める some important stuff, and the more you can concentrate as you struggle through it, the easier your programming will be hereafter. If you think reading it is tedious, give a thought to how tedious 令状ing it was!

An "old friend" you may have met recently

You may have seen the に引き続いて code before. It is okay if you 港/避難所't. If you are very new to Lazarus, you might want to work through the tutorial which led to this code, but you probably do not need to for the points I want to make in this tutorial.

部隊 ld002u1;

(*A very simple arithmetic 実験(する)ing program
  for helping 使用者s master 2+3, 8+2, etc.

  Written as an example of using Lazarus or
  Delphi, and explained at....

  https://sheepdogguides.com/lut/lt1Na.htm
  *)

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, 支配(する)/統制するs, Graphics,
  Dialogs, StdCtrls;

type

  { TLD002f1 }

  TLD002f1 = class(TForm)
    buQuit: TButton;
    eAnswer: TEdit;
    laQuestion: TLabel;
    手続き buQuitClick(Sender: TObject);
    手続き eAnswerChange(Sender: TObject);
    手続き FormCreate(Sender: TObject);
  私的な
    { 私的な 宣言s }
    bNum0,bNum1:byte;
    sAnswer:string;
    手続き PrepareQuestion;
  public
    { public 宣言s }
  end;

var
  LD002f1: TLD002f1;

実施

{$R *.lfm}

{ TLD002f1 }

手続き TLD002f1.buQuitClick(Sender: TObject);
begin
  の近くに;
end;

手続き TLD002f1.eAnswerChange(Sender: TObject);
begin
if eAnswer.text=sAnswer then begin
   showmessage('権利!');
   PrepareQuestion;
   end;
end;

手続き TLD002f1.FormCreate(Sender: TObject);
begin
  randomize;
  PrepareQuestion;
end;

手続き TLD002f1.PrepareQuestion;
begin
   bNum0:=無作為の(10);
   bNum1:=2;
   laQuestion.caption:='What is '+inttostr(bNum0)+
      ' + '+inttostr(bNum1)+'?';
   sAnswer:=inttostr(bNum0+bNum1);
   eAnswer.text:='';
end;

end.

Don't be 脅すd

While that might be a little 脅迫してさせるing, all of that can be "boiled 負かす/撃墜する" to just....

部隊 NAME;
  STUFF
interface
  STUFF
実施
  STUFF
end.

That's the basic 輪郭(を描く) of any Lazarus (or Delphi) 部隊.

It starts with the word "部隊", followed by the 部隊's 指名する, followed by a semicolon

I'm not going to say "followed by a semicolon" over and over again.

Where you see a semicolon, it is important. Where there is no semicolon, don't put one in "just in 事例/患者". We'll talk more about semicolons as we go along, and in その後の tutorials. You'll "get it" 結局, but if it takes a while, you won't be the first person to 悪口を言う/悪態 them.

After the "部隊 ld002u1;" line, which "始める,決めるs the scene, tells the compiler what sort of things follow, you may or may not have some "stuff"

結局, you will (in a 正確に 構成するd 部隊 とじ込み/提出する) have the word...

   interface

... which 示すs the beginning of the first section of the 部隊.

That will be followed by some "stuff".

Next you will come 結局 to a line with the word...

   実施

... which will be followed by some more "stuff".

And, at the very end, you need to have...

   end.

... and don't 除去する the "." after the "end"... it is 要求するd.

Happily, all of the above is created for you by your RAD ("早い 使用/適用 開発") 環境, be it Lazarus or Delphi.

So. What's all that "stuff"

That's the 全体にわたる structure of any 部隊.

Now we will delve into the things I called "stuff" in my abbreviated 名簿(に載せる)/表(にあげる) of what is in a 部隊.

Between "部隊 NAME" and "interface"...

Both Lazarus and Delphi will do most of the work for you in regards to what goes before "interface".

That weird line....

{$mode objfpc}{$H+}

... Looks at first ちらりと見ること like two squiggly bracket comments, but the $ after each of the {'s makes each of them a special 肉親,親類d of comment called a compiler 指示的な. The good news is that Lazarus will create what you need. Just don't "mess with it" until you know what you are doing. (Delphi doesn't create a compiler 指示的な here, but it does create at least one in other places. Again: Just go with the flow.)

It is, however, a good idea to put lots of comments in this section. You should 令状 a description in this section 説 what the 使用/適用 does.

It is also a good place to put comments about 現在の problems with the code. Also your "to do 名簿(に載せる)/表(にあげる)" (features you are thinking of 追加するing). A history of the 使用/適用's 開発 is also a good thing to put here.

If you follow my 指導/手引, you will not put (警察などへの)密告,告訴(状) about what 見解/翻訳/版 of the code this is in this section.


Interface section

I hope you think that it is "so far, so good"? Pretty 平易な going, so far?

We're going to skip over the interface section for now, and look at "the heart" of the code, the 実施 section.



実施 section

Just to save you scrolling 支援する here it is again...

実施

{$R *.lfm}

{ TLD002f1 }

手続き TLD002f1.buQuitClick(Sender: TObject);
begin
  の近くに;
end;

手続き TLD002f1.eAnswerChange(Sender: TObject);
begin
if eAnswer.text=sAnswer then begin
   showmessage('権利!');
   PrepareQuestion;
   end;
end;

手続き TLD002f1.FormCreate(Sender: TObject);
begin
  randomize;
  PrepareQuestion;
end;

手続き TLD002f1.PrepareQuestion;
begin
   bNum0:=無作為の(10);
   bNum1:=2;
   laQuestion.caption:='What is '+inttostr(bNum0)+
      ' + '+inttostr(bNum1)+'?';
   sAnswer:=inttostr(bNum0+bNum1);
   eAnswer.text:='';
end;

The first line...

{$R *.lfm}

... is one of those compiler 指示的なs I told you about in the "Comments" tutorial. You don't need to worry about what it does. You don't have to remember to put it in. You do have to leave it alone after Lazarus puts it in for you.

The next line.....

{ TLD002f1 }

....is a simple comment, created by Lazarus from the 指名する of the form, "LD002f1". (Don't worry about the "T" part yet!) This is the code that "operates" the form LD002f1, which is a form of the 使用/適用 LD002. (You will probably only use one form per 使用/適用 for a while, but an 使用/適用 can have 多重の forms.) The "tidy" 指名するing is all 負かす/撃墜する to the programmer's choices, and the choices made here follow my working practices.

Then there are three...

封鎖するs

I've gone a little overboard celebrating the word "封鎖するs", but they are a 広大な/多数の/重要な feature of Pascal, Lazarus, Delphi, HTML, and many other computer 支配(する)/統制する 機械装置s. They 延長する beyond the world of computers into anything engineers have had something to do with.

In 幅の広い 条件, not 正確に/まさに Lazarus 条件... yet... a "封鎖する" is a discrete (独立の)存在 you can work with without worrying too much about the other 封鎖するs in the system. You might use the word "module" for the same 概念.

In a car, for instance, there's the engine, the wheels and 中断, the 乗客 独房 (keep you 安全な and 乾燥した,日照りの), the lights (headlights, turn signals, etc).

Each of these are like the "封鎖するs" I am trying to get you excited about. And part of the 推論する/理由 for 存在 excited is that, in a 井戸/弁護士席 designed system, there can be 封鎖するs within 封鎖するs within 封鎖するs. And whatever 技術s you need to work with a 封鎖する at one level also help you when you work with a 封鎖する of another level.

Here is the first of the 封鎖するs in the code we are working though...

手続き TLD002f1.buQuitClick(Sender: TObject);
begin
  の近くに;
end;

... and this is the next...

手続き TLD002f1.eAnswerChange(Sender: TObject);
begin
if eAnswer.text=sAnswer then begin
   showmessage('権利!');
   PrepareQuestion;
   end;
end;

... and this is the third 封鎖する...

手続き TLD002f1.FormCreate(Sender: TObject);
begin
  randomize;
  PrepareQuestion;
end;

... and all that is left is a fourth 封鎖する...

手続き TLD002f1.PrepareQuestion;
begin
   bNum0:=無作為の(10);
   bNum1:=2;
   laQuestion.caption:='What is '+inttostr(bNum0)+
      ' + '+inttostr(bNum1)+'?';
   sAnswer:=inttostr(bNum0+bNum1);
   eAnswer.text:='';
end;

Neat? You've already spotted, I hope, the similarities between those, but don't worry if you 港/避難所't.

A quick little thing to dispense with: It doesn't 事柄 which order those 封鎖するs appear in. In fact, if you are careful, and take a whole 封鎖する, and don't move it into the middle of another 封鎖する, you can re-arrange the sequence of the 封鎖するs. I いつかs... not very often... do that to get several things that I am 現在/一般に working on 近づく one another in the code.

One of the 広大な/多数の/重要な joys of working with 封鎖するs is that if you do it 適切に, you only need to look at one 封鎖する at a time. Your work is made manageable.

To jump ahead a bit... not only can things be broken into 封鎖するs, as we are seeing at the moment, but you can 組み立てる/集結する "little" 封鎖するs, and from them make bigger 封鎖するs, and from a few "bigger" 封鎖するs make a 抱擁する 封鎖する... and at any given level, the 詳細(に述べる)s of how the smaller 封鎖するs are made are not "underfoot". But! To go 支援する to what we were 説....

Each of those 封鎖するs boils 負かす/撃墜する to the に引き続いて. Where I've done something all in 資本/首都s, it 代表するs a "placeholder" for a place where different things 存在する in different 封鎖するs...

手続き NAMEofPROCEDURE;
begin
  STUFF
end;

The NAMEofPROCEDURE thing will be taken care of as we go along in the さまざまな tutorials. いつかs, for instance when you start to build an OnClick event handler for a button, the system takes care of everything for you. Other times you will have to (不足などを)補う a 指名する, and 適切に "plug" the whole thing into your code. There are a few ways to go wrong doing the plugging in, but I will help you, as the need arises.

After the first line, "手続き...", in our examples, our 封鎖するs always start with begin, and end with end;. Don't 行方不明になる the semicolon!

That semicolon is the "glue" between the 封鎖するs.

There will いつかs be 確かな things before the begin... you'll be seeing them as the need for them arises.

Let's look at the 団体/死体s of the four 手続きs...

= 1 ====== buQuitClick
      の近くに;
      
= 2 ====== eAnswerChange...
      if eAnswer.text=sAnswer then begin
         showmessage('権利!');
         PrepareQuestion;
         end;
= 3 ====== FormCreate(Sender: TObject);
      randomize;
      PrepareQuestion;
= 4 ====== PrepareQuestion;
      bNum0:=無作為の(10);
      bNum1:=2;
      laQuestion.caption:='What is '+inttostr(bNum0)+
            ' + '+inttostr(bNum1)+'?';
      sAnswer:=inttostr(bNum0+bNum1);
      eAnswer.text:='';

The first 手続き, buQuitClick, is a really simple 手続き: It only does one thing!

The third (we'll come 支援する to the second one) 手続き, FormCreate, does two things.

See the semicolon on the end of "randomize"? It 行為/法令/行動するs as "glue".... between a begin and an end, you are 許すd, 厳密に speaking, one "thing"... more 適切に called a 声明. This is what we have with the buQuitClick code.

But there's a trick. If you have two 声明s, e.g. "randomize" and "PrepareQuestion", and put a semicolon between them, the result...

randomize;PrepareQuestion

... "counts as" "one" 声明, so it can go between a begin and an end! Such "out of many, one" 声明s are called 構内/化合物 声明s.

And you are 許すd to, advised to, stick in a carriage return to 分裂(する) things up on the 審査する to make them more readable....

randomize;
PrepareQuestion

Now then. Another semicolon. Put one after the "PrepareQuestion", before the "end". you don't 現実に need one here. As long as between the begin and the end you have "a 声明", be that....

の近くに

(a simple 声明), or...

randomize;PrepareQuestion

a 構内/化合物 声明, with semicolon "glue" between the 選挙権を持つ/選挙人 parts, all will be 井戸/弁護士席.

But take it from me: Put in the semicolon after the 声明, before the end. And extra semicolon, here, will do no 害(を与える). And if you always put it in, you won't have to を取り引きする the problems which arise if you subsequently 追加する 声明s to what is between the begin and the end, and you forget the "flue" semicolon.

Just to show you again, in 十分な, the two we've been talking about...

手続き TLD002f1.buQuitClick(Sender: TObject);
begin
  の近くに;
end;

手続き TLD002f1.FormCreate(Sender: TObject);
begin
  randomize;
  PrepareQuestion;
end;

Are you beginning to see the method in the madness? I hope so. We're going to go of on a tangent....

Learning English

I once taught a computer to "speak" English.

I said: Here are some nouns, suitable as 反対するs...

... and here are some nouns for people...

... here are some adjectives...

... and some verbs...

Now then computer, I then said: Here's how you make a 宣告,判決....

Person-noun+ verb+ "the"+
  (いつかs: an adjective)+ 反対する-noun.

And すぐに, the computer could produce...

Of course, things like "Henry sold the red river" (機の)カム out... improbably, probably... but still intelligible.

Once you finish the hard work of some basic 支配するs, it is often 平易な to 拡大する them, if they were designed 権利. With Lazarus, the 支配するs are "finished", and 広範囲にわたる... and as you 進歩, you will struggle to get started, but then things move ahead more easily. To 延長する the "language" example just a little その上の....

合同s...

New 支配する: Here's another way to make a 宣告,判決....

Person-noun+ 合同+ person-noun+ verb+
    the"+ (いつかs: an adjective)+ 反対する-noun.

And すぐに, the computer could also produce...

Why did I introduce this tangent?

Programming is like the above. There is a 確かな vocabulary to master. And then the words you know have to be put together, but not "just anyhow". You have to follow very simple 支配するs.

Learn the 支配するs, and half of your programming hassles will go away.

One of the 支配するs is that the code for an 使用/適用, as I said at the start of this, consists of...

部隊 NAME;
  STUFF
interface
  STUFF
実施
  STUFF
end.

It might not always seem that simple... but it is!

Now all you have to do is learn what's 許すd for the different sorts of "stuff".

We were talking about the 実施 section, and we're nearly done with that.

Before we leave it, and cover the "interface" section, just a 予選 word about something which should have been bothering you.

Why do some "手続き..." lines look 比較して simple, e.g....

手続き TLD002f1.PrepareQuestion;

... while others, e.g....

手続き TLD002f1.buQuitClick(Sender: TObject);

... are "fancier"?

The "(Sender:TObject)" stuff will be 現在の, in that form, on the end of the 手続き 声明 for event handlers created for you by 二塁打-clicking on something on your form. You don't need to know more than that for now. You don't want to put anything like that in your 手続き 声明s, i.e. the lines that explain what a 手続き created by you, like the "PrepareQuestion" 手続き.

Both of those lines start "TLD002f1."

And they should. The "T" stands for "Type", and I've been wimping out, not 演説(する)/住所ing that, for some time now. (And will continue to do so).

The "LD002f1" part derives from the fact that we 指名するd the form we are working with "LD002f1" (for Lazarus デモ, number 2, Form 1). In the 実施 part of your code, as long as you are doing things "my way", the 手続き 声明s will always start with T<something-決定するd-by-the-form's-指名する>. and then the 手続き's 指名する.

封鎖するs within 封鎖するs

We're now going to look more closely at...

手続き TLD002f1.eAnswerChange(Sender: TObject);
begin
if eAnswer.text=sAnswer then begin
   showmessage('権利!');
   PrepareQuestion;
   end;
end;

It boils 負かす/撃墜する to...

手続き TLD002f1.eAnswerChange(Sender: TObject);
begin
if eAnswer.text=sAnswer then...
   SOMETHING
end;

The basic if 声明 consists of...

if CONDITION then STATEMENT

The 条件 is something that will boil 負かす/撃墜する to "true" or "誤った". In this 事例/患者, either what is in eAnswer.text is the same as, is equal (=) to what is in the variable sAnswer, or it isn't.

The 声明 is any of the many, many, 合法的な Lazarus 声明s, e.g. showmessage('Hi').

That's the simple 事例/患者. But if you want to do something more コンビナート/複合体, as we do here, you can "包む" a bunch of 声明s together, "gluing" them with 半分-結腸s, and "wrapping them" in a begin and an end.

You can't JUST "glue" them together with 半分-結腸s, or only the first (basic) 声明 after the then will 遂行する/発効させる when the 条件 is true.

使用者 defined 手続き as "封鎖する"

Here's another thing.

I hope you've done the tutorial in which the code was developed? The 使用者 defined 手続き "PrepareQuestion" is itself a 封鎖する of code, a 機械装置 for "一括ing" 詳細(に述べる)s, to get them out of sight, out of the way of seeing the forest for the trees.

At one level, we don't care what happens within "PrepareQuestion". We just call that 手続き, once during the FormCreate handler, and whenever a 使用者 gets a problem 権利. In the code 取引,協定ing with those two times when a new problem is needed, we see just "PrepareQuestion". If we need (or want) to see more 詳細(に述べる)s, we go to the code that defines "PrepareQuestion". We are dividing the problems, and that should help us 征服する/打ち勝つ the 仕事 of 令状ing the 使用/適用.

Interface section

井戸/弁護士席, I've put it off as long as I can.

When you start building a new Lazarus 使用/適用 with "とじ込み/提出する | New | New 使用/適用", やめる a bit of code is put in the Source Editor before you even 追加する a "やめる" button to the 使用/適用.

Much of this code is in the interface section, and, thankfully, much of this code you don't need to worry about... but I'll take you through it, in a moment. Some of what you see won't be 正確に/まさに what is in the interface section of LD002, because as we worked with LD002, in 新規加入 to the bits we changed by 手渡す, Lazarus altered things for us.

The に引き続いて is a section of what is in my Source Editor after I've started a new 使用/適用 and 追加するd a button to the form. I 港/避難所't done any of my normal re-指名するing of elements of the 使用/適用 yet. You can see that the section I've 名簿(に載せる)/表(にあげる)d starts at the word "interface", the start of the interface section, and goes 負かす/撃墜する to the first thing after that section, the word "実施", which ends the "interface" section, and at the same time starts the next section, the interface section, which we just finished discussing.

interface

uses
  Classes, SysUtils, FileUtil, Forms, 支配(する)/統制するs,
  Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
  私的な
    { 私的な 宣言s }
  public
    { public 宣言s }
  end;

var
  Form1: TForm1;

実施

At this point, there are three things in the interface section:

Those are the sections, the "封鎖するs" (although I stretch the 称する,呼ぶ/期間/用語 there) of our basic interface code 封鎖する. Let's go through them...

For now, you don't have to worry about what is 名簿(に載せる)/表(にあげる)d after uses. The 名簿(に載せる)/表(にあげる) tells the compiler that for some of the things we want in the code, the compiler needs to look in some 部隊s, e.g. "Classes, SysUtils, FileUtil..." which are 供給するd with Lazarus, and 含む/封じ込める the 詳細(に述べる)s of how to do 確かな things. In 予定 course, you may be 令状ing 部隊s of your own, and using them in other programs 経由で the uses 声明 at the 最高の,を越す of those other programs. But you won't need those 技術s for a long time.

The next 声明 is...

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
  私的な
    { 私的な 宣言s }
  public
    { public 宣言s }
  end;

In earlier tutorials, we've talked about data types. So far, I have funked getting into the 詳細(に述べる)s of what an "反対する" is, and it 限界s how 正確に I can talk about what is going on above, so 許す a "fuzzy" explanation?

The central essence of our 使用/適用 is a "thing" that Windows or Linux can work with, a "thing" the operating system can work with to put stuff on the 審査する in 前線 of us.

Getting our 使用/適用 built proceeds in 行う/開催する/段階s. First we define a new type of 反対する. (The word "type" is used there both in the Lazarus sense, and in the everyday sense.) The "type" (in the Lazarus sense) that we have created, in the above, is 指名するd "TForm1". (The "T" comes from "type".)

Once we've created the TForm1 type, and I'm going to come 支援する to that, we are able to do the last thing in the 極小の interface 爆撃する shown above...

var
  Form1: TForm1;

That 声明 says, "You know the type called TForm1? I need an instance of that type, and I want to call it Form1."

The word var is built into Lazarus. It says that the "宣言" of something is coming. We are about to 宣言する that we need a variable (or 類似の) created, so that we can subsequently use it.

In this instance, it is not やめる a "variable" we are creating. We are creating something bigger. So big, in fact, that it pretty 井戸/弁護士席 含む/封じ込めるs the whole 使用/適用.

Keep reading, but console yourself with the fact that you don't have to fully understand all of this now ーするために 令状 Lazarus 使用/適用s... but the more you can しっかり掴む, the より小数の 混乱s you will have どこかよそで.

A moment ago, I said that "var Form1: TForm1" creates an instance of a TForm1-type thing.

"Car" is a 概念 not too far 除去するd from the idea of a "type". My car, an old Subaru, is and instance of the general 概念, the type, "car".

We've seen var before in earlier tutorials, in things like....

var bNum0,bNum1:byte;

In that line, we are telling the compiler that we need two variables. We are 宣言するing them. That makes the compiler get ready for us to use them. We have 宣言するd that we need two variables, bNum0 and bNum1, and that they should be 始める,決める up ready to 持つ/拘留する byte-type data.

When we used var a moment ago with var "Form1: TForm1", we weren't doing anything radically different. It is just harder to get your mind around what a "TForm1" "thing" is. I 港/避難所't put "TForm1" in bold, because that is not a 根底となる, built in, Lazarus word. We've created that type, rather like we created the 使用者-defined 手続き.

Which brings me nicely(?) 支援する to その上の discussion of the type 声明 we looked at 以前.

(土地などの)細長い一片 out all the comments in it, and you are left with...

type
  TForm1 = class(TForm)
        Button1: TButton;
  私的な

  public

  end

The "end" here is partner to the word "type". The end 示すs the end of the type 声明. The semicolon I didn't copy, the one after the end is not part of the 声明, is 単に "glue" to join this 声明 to the next in the 全体にわたる structure of the 使用/適用's code.

The first thing after the word type at the start of the 声明 is

TForm1=

"TForm1" is a 指名する made up for the type we are created by sticking a "T" in 前線 of the 指名する of the form we are working with. The Lazarus system does a 広大な/多数の/重要な 職業, by the way, of "支援する 言及/関連ing" changes. An hour into working on an 使用/適用, I can decide to change the 指名する of the main form... and all the places which need changing are changed as soon as I 単に change the form's 指名する, using the 反対する 視察官. But for this to work, you do have to make the 指名する change with the 反対する 視察官.

This is probably the place to repeat: Until you know more, resist the 誘惑 to "fiddle" with things you 港/避難所't been shown about fiddling with.

So... we know what "type TForm1=" is about. Moving on...

type
  TForm1 = class(TForm)

Class is a build in Lazarus word, as is TForm. We won't go into 詳細(に述べる) here. 十分である, I hope, it to say that what you see above translates 概略で to "Things of the TForm1 type will be things that we can do a lot with, as defined by the "TForm" 鮮明度/定義.

Moving 速く and ruefully on...

By having...

   Button1: TButton;

.. in the first section of the type 鮮明度/定義, we are 説 that a button called Button1 is part of the "thing" that we will create in a moment with "var Form1: TForm1;"

(Lazarus took care of 追加するing this line to our code when we used the human friendly, GUI, techniques to put the graphical depiction of a button on the form on our 審査する. TButton is a built in Lazarus word. It defines what a button is, has, can do.)

Let me remind you: We 追加するd (just) a button to the basic "empty" 使用/適用 before we 明言する/公表するd working though what is in the 初期の code.

So! After the multi-line, コンビナート/複合体, "TForm1=... bit", we come to two words:

私的な

public

No semicolons, by the way. The two words 私的な and public are section headings within the interface section, just as interface and 実施 are sections of the 使用/適用's 全体にわたる code. As such, they don't need semicolons, because the compiler already knows the "形態/調整" of things.

You will put さまざまな things into the code, usually between the words "私的な" and "public". Make your 新規加入s there until その上の notice, anyway. Where you put the things I'm going to talk about won't be important to a beginner's needs.

Put a semicolon after each thing you 追加する after the "私的な"

What did we 追加する to the LD002 while we were working on it? By the time we were through, the 私的な section held...

    bNum0,bNum1:byte;
    sAnswer:string;
    手続き PrepareQuestion;

The first two 声明s create variables which we will use later. The last says that we are going to have a 使用者-defined 手続き in our 使用/適用. We "宣言する" the 手続き here, we say what it will do later, in the 実施 part of the 使用/適用's code.

We've talked about this before, but now you are ready to understand something which may have puzzled you until now. But before I 演説(する)/住所 that, a little 詳細(に述べる) to be (疑いを)晴らす about

In the 私的な section you may have no, one, or many variable 宣言s. It doesn't 事柄 what order you put them in... but put all of the variable 宣言s in before you put the first 手続き 宣言 in.

A 手続き is something you've met, one example of a subroutine. Another sort of subroutine, which you've barely met, is the 機能(する)/行事. You've met built in 機能(する)/行事s like 無作為の(). If you are doing my tutorials in sequence, you have not yet met 使用者-defined 機能(する)/行事s... but you will before long. They aren't hard. They are useful.

As I said: After 私的な, 名簿(に載せる)/表(にあげる) all the variable 宣言s you need first. After that, the sub-決まりきった仕事 宣言s come... all of the 宣言s of 使用者-defined 手続きs and 機能(する)/行事s. You can mix them up. Just be sure they come after the variable 宣言s.

(The same 支配する should be followed if you put anything in the public section.)

Whew!

Something you may be wondering about: When to "var", when not to "var". When we 手配中の,お尋ね者 to 宣言する that we needed a TLD002F1-type "thing", we said....

var LD002f1: TLD002f1

... but when we 宣言するd "bNum0:byte", and "手続き PrepareAnswer", we didn't use var. The 推論する/理由 is 状況. You could say that the "var" was implicit in the "私的な" which (機の)カム just before where we 宣言するd bNum0, 手続き PrepareQuestion, etc.

And another thing...

It took me years to get to the 底(に届く) of when you have the TLD002F1. in 前線 of the 指名する of a 使用者-defined 手続き, because I was doing things in 多重の, 混乱させるd ways. It is 現実に not 複雑にするd at all. Do remember that it won't always be "TLD002F1"... but, if you use my 条約s, it will be something like that.

Up within the...

type

  { TLD002f1 }

  TLD002f1 = class(TForm)...

... part, when you get 負かす/撃墜する into the 私的な section, and you are 宣言するing, say, PrepareQuestion, you do NOT prefix it with "TLD002f1.", because, from the 状況, it is already 暗示するd that we are talking about an element of TLD002f1.

However, 負かす/撃墜する in the 実施 section, were we are setting out the 詳細(に述べる)s of what should happen when the "PrepareQuestion" 手続き is invoked, then we DO 含む the TLD002f1. to say "the PrepareQuestion which is part of the TLD002f1" "thing". Thus...

手続き TLD002f1.PrepareQuestion;
begin
   bNum0:=無作為の(10);
   bNum1:=2;
   laQuestion.caption:='What is '+inttostr(bNum0)+
      ' + '+inttostr(bNum1)+'?';
   sAnswer:=inttostr(bNum0+bNum1);
   eAnswer.text:='';
end;

Call me "Oliver", but... "I want some MORE...."

You must be tired by now, but this is the time to について言及する something その上の.

In another tutorial, at the 底(に届く), I 支持するd having a constant called "ver" in every 使用/適用 you 令状, and putting a string in that which identifies the 見解/翻訳/版 of the particular .exe とじ込み/提出する which a 使用者 has.

The Lazarus "骸骨/概要" we have struggled through in the hundreds of lines in this tutorial does not illustrate every possible 成分 of a Lazarus 使用/適用.

The const 声明 lets you create, funnily enough, CONSTants!

To create a constant called "ver" (for 見解/翻訳/版), and fill it with "1 August 2011", all you need is....

const ver='1 August 11'

(You follow it with the usual semicolon, to glue this 声明 to the next in the 使用/適用's code.)... and you put your const 声明 just after the uses 声明, 近づく the 最高の,を越す of the code.

Big WHEW! Done At Last!!

I 推定する/予想する that took 重要な willpower to 骨折って進む through. I 約束 you that I really do think that a しっかり掴む of what I was trying to 伝える is important. I hope you will revisit this tutorial when you have more experience, see if some of the things that didn't make sense this time make better sense when you are more Lazarus experienced.

Something you can skip!

In my manic frenzy to tell you "everything", it is hard for me to be as selective as perhaps I せねばならない be, but there is one thing I believe you can 安全に "neglect".

If you followed my advice, and created a folder for each of the Lazarus (or Delphi) 使用/適用s you have created so far, you may be puzzled by all the とじ込み/提出するs which somehow 蓄積する in those folders.

The .exe とじ込み/提出する is the only とじ込み/提出する you need to pass on to anyone you want to give your 使用/適用 to.

The .lpi とじ込み/提出する is the one you should 二塁打-click on, if you want to 開始する,打ち上げる Lazarus with that 事業/計画(する) 負担d for modification.

Apart from those two, you don't need to know what the other とじ込み/提出するs are all about!

If you want to move your work on an 使用/適用 from one system to another, just send all of the とじ込み/提出するs in the folder across.





            力/強力にするd by FreeFind
  場所/位置 search Web search
場所/位置 地図/計画する    What's New    Search This search 単に looks for the words you enter. It won't answer "Where can I download InpOut32?"

If you visit 1&1's 場所/位置 from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They 申し込む/申し出 things for the beginner and the 会社/団体.www.1and1.com icon

広告 from page's editor: Yes.. I do enjoy 収集するing these things for you. I hope they are helpful. However... this doesn't 支払う/賃金 my 法案s!!! Sheepdog ソフトウェア (tm) is supposed to help do that, so if you 設立する this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and 循環させる it for me? Links on your page to this page would also be 高く評価する/(相場などが)上がるd!
Click here to visit editor's freeware, shareware page.

Link to Lazarus Tutorials main page
How to 接触する the editor of this page, Tom Boyd


Valid HTML 4.01 Transitional Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org


If this page 原因(となる)s a script to run, why? Because of things like Google パネル盤s, and the code for the search button. Why do I について言及する scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....