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

翻訳前ページへ


Getting Started with Lazarus programming- one in a 一連の "how to"s for Lazarus (Delphi) HOME - - - - - Lazarus Tutorials TOC - - - - - - Other 構成要素 for programmers


Getting Started with Lazarus Programming

This will take you from knowing nothing to having an idea

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!

filename: lt0Na.htm

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.)


Please concentrate so that you 吸収する everything in this tutorial. There will be a 実験(する) on Friday. It may be a long slog... but 価値(がある) it, I 約束.

Your reward? I will try to 差し控える in my other tutorials from endlessly repeating さまざまな things which are explained here.

I would 示唆する working through this tutorial in several 開会/開廷/会期s. Trying to 吸収する it all in a 選び出す/独身 sitting may be 極端に ambitious, unless you have a good 取引,協定 of 関連した 事前の knowledge. Do, please, try to master what is here before 試みる/企てるing my other Lazarus tutorials... there are some 根底となる 問題/発行するs, and some are not general Lazarus 問題/発行するs.




This tutorial has been online since 2011. It was given a "polish" in 2015. In 2020, I reviewed it again.. and 設立する that what was true in 2015 still 作品 罰金 in 2020. Not because Lazarus is 沈滞した, but because it was already a good 製品 in 2015. The illustrations here come from 見解/翻訳/版 0.9.30, but are so の近くに to what we still see today, 5/2020, 見解/翻訳/版 2.0.0 on my machine, is still just 罰金. Hurrah for stable 製品s!

I was working on a Windows 10 machine. (Vers 1909)


For almost everything in this tutorial (the main exception has an explanatory 公式文書,認める at the 関連した 位置/汚点/見つけ出す), what you would do in Delphi would be no different. At this level, the tutorial is as good for Delphi learners as it is for Lazarus learners. (I 現実に did the tutorial, but using Delphi (見解/翻訳/版 4), to 実験(する) that 主張!)

Let's do it!

Start up your Lazarus. Do "とじ込み/提出する | New | New 使用/適用". When I'd done that, and 配列し直すd things on the 審査する a bit, I had....

A Lazarus work session.. what you see on screen

In this tutorial we will create an 使用/適用 with two buttons...

One button to の近くに 負かす/撃墜する the 使用/適用

One button to 陳列する,発揮する the 現在の time on the form

Yes... if I 手配中の,お尋ね者 a 使用/適用 to 陳列する,発揮する time on the 審査する, I wouldn't 要求する 使用者s to click a button to see what the time is! Please understand: this is just a little デモ. It has enough in it to be useful for getting you started with Lazarus programming. I've left some elements you will want to know soon for another time, for 恐れる that there's already やめる enough here for an 早期に 開会/開廷/会期.

指名するing of parts....

Here's what I want you to notice in the illustration above. Across the 最高の,を越す: the main Lazarus window, with the menu, which gives you ponderous 接近 to everything (No more ponderous than with any large 使用/適用.)

Also in the main window, the buttons which give you quick ways to do さまざまな things...

Lazarus buttons

We'll introduce them as they are needed. You can always use the menus, anyway, if you can't find the button you want.



Lastly in the main window, we have the 構成要素s palette....

Lazarus components palette

This is a tabbed 反対する. In the illustration, we are looking at the 構成要素s in the "基準" group.

At the 底(に届く) 権利 of the 審査する, we have a wide window 肩書を与えるd "Messages". This is where we get messages from the system when we try to do things. (If only everything were so mundane! Just thought I'd get that one out of the way!)

That leaves three windows, across (more or いっそう少なく) the middle part of the vertical dimension of the 審査する.

On the left, we have the 反対する 視察官. This is terribly important to your happiness while doing Lazarus programming, and we will come 支援する to it.

Next is the Source Editor. It already has a bunch of stuff in it! This is the Lazarus-供給するd 骸骨/概要 for our 使用/適用. You will "令状 your program" here.

And lastly, on the 権利, a Window 肩書を与えるd... for the moment... "Form1". This is the form design window. Here you will create the "直面する" of your 使用/適用; here you will create what your 使用者s see.


Your first 使用/適用....

Take a 深い breath... Here we go...

(You might want to skim quickly through the 構成要素 above one last time. Make sure it has "sunk in" before you proceed?)

A shocking request! It won't remain in 軍隊 for long! (Almost) always, the 支配する is "Save, save, save. But, for the moment, don'ttry to save your work(!)

-----
In the 構成要素 palette, counting the one that is an arrow, a pointer, as the first, count across to the third or 前へ/外へ (different in different 見解/翻訳/版s of Lazarus) icon... the one that says "承認する". That's the button 構成要素. Click on it. 解放(する) your mouse button, move the mouse pointer to over the middle of the form, in the form designer, and click again. Ta da! You've put a button 構成要素 on your form!! (It doesn't 事柄 if it isn't やめる in the 権利 place on the form, etc, etc.) (Please always assume that I mean "... and 解放(する)" if I say "click on...".)

I'll talk about what a "構成要素" is in a moment. I'll explain why when you hovered over the icon on the 構成要素 palette, the pop-up said TButton. But let's have a little "fun", first? (A very little, I 恐れる, but some.) 耐える with me?

二塁打-click on the button on the form. The 審査する may seem to わずかに flicker. What you might not notice, unless you are 警報, is that after you have 二塁打-clicked on the button on the form, some new 構成要素 has appeared in the code in the Source Editor window. It is....

手続き TForm1.Button1Click(Sender: TObject);
begin

end;

... (Just in 事例/患者 you 位置/汚点/見つけ出す it: Some other new stuff appeared too, but we aren't going to talk about it today.)

Click on the empty line between the begin and the end just below the 手続き TForm1.Button1Click(Sender: TObject);

That will put the insertion point there. Now type in...

の近くに;

Be sure to 含む the 半分-結腸! That will make the whole thing say...

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

We've created an 使用/適用! (Though it might not seem like it yet, and you 港/避難所't yet seen it in 活動/戦闘, and it doesn't do much! But, hey! We have created an 使用/適用!)

Running your first app for first time...

In the Lazarus main window buttons is a green "arrow", made of a 権利-pointing triangle. If you hover over the button I mean, you get a pop-up 説 "Run".

Click the "Run" button, and be a little 患者. Watch the messages window while you wait, and keep your other 注目する,もくろむ on the "Form1" window.

If you've not made any typos, the messages will 結局 解決する to....

事業/計画(する) "project1" 首尾よく built

... or...

収集する 事業/計画(する), 的: C:\使用者s\Tom\AppData\地元の\Temp\project1.exe: Success

... and the background of Form1 will (疑いを)晴らす, the dots will go away. (They are a grid for placing things neatly.)

Your 使用/適用 is running! Click the button called "Button1", and your stop 使用/適用's running. It will be "の近くにd", because that's what you programmed the 使用/適用 to do when that button is clicked!

(You'll get a message from Lazarus 説 "死刑執行 stopped." Your mother will be proud of you if you say "Thank you" as you click "承認する". I'm not sure why the Lazarus developers thought we need the message... but knowing so little at this moment, I'm not going to click the "Do not show this message again" 選択 just yet.)

Pretty 冷静な/正味の, really... even if we 港/避難所't done very much yet. You wouldn't believe all of the things going on in the background. Just think about what your 使用/適用 does when it runs... and there's an awful lot in the background of which you may not be aware, let alone all of the things that had to be 供給するd for by Lazarus to 許す you to build this 使用/適用, be it ever so humble!

Run it again by clicking the green arrow button. And shut your 使用/適用 負かす/撃墜する with "Button1". Not very exciting... but it is all the 使用/適用 can do, so far. 井戸/弁護士席... almost all. You already have a window which can be moved, maximized, re-sized, etc... That's no small 取引,協定 in itself.

Okay... we've put off saving our work too long. But before we save what we have, just a few more bits and pieces.

Stop your 使用/適用 again, if it isn't already stopped at the moment....

Digression...

Ah! A 肉親,親類d reader wrote on に代わって of all those to come in the 未来, and pointed out a Newbie Gotcha....

You mustn't 行方不明になる or skip the bit above that says "stop your 使用/適用".

You can tell you've stopped it because the green "Run" "arrow" (triangle) in the main Lazarus 妨げる/法廷,弁護士業 will be green again, instead of the gray it turned while your little app was running. (It turns gray to stop you from starting up something that is already running.)

If for some 推論する/理由 your button won't stop your 使用/適用, you can "kill" (stop) it the way you stop any 使用/適用: In Windows with the little "x" in the upper 権利 手渡す corner of the window. (Sorry, Linux folks... you have something 類似の, I believe, but I don't 解任する if it is also an "x".

Can't stop your app? かもしれない because you can't find it? It may be "under" some other window. Even if you can't find it, there should be a button on the taskbar. 権利-click that, click "の近くに window".


As I was 説... Stop your 使用/適用. (If the Lazarus "run" button (triangle) is green, not gray, then you have it stopped.)

Click somewhere in the field of gray which is covered with dots on the "Form1" window. Then look at what you see in the 反対する 視察官's window. It is something you will use extensively while building 使用/適用s. In the pane at the 最高の,を越す, you should see....

Lazarus Object Inspector

If "Button1: TButton" is 最高潮の場面d instead of "Form1...", you can 直す/買収する,八百長をする that 簡単に by clicking on the "Form1..." line.

You should have the "所有物/資産/財産s" tag selected. not "Events", "Favorites", etc.

Scroll 負かす/撃墜する the 所有物/資産/財産s until you get to "指名する".

For the next few minutes, just 圧力(をかける) ahead, doing as I say (please), and using the 事例/患者 I use with letters. I.e. if I say type "fish", don't type "Fish" or "FISH".

I'm going to go quickly through some stuff, and then go 支援する through it more carefully, explaining things that might not make 即座の sense....

In the edit box next to "指名する" enter....

ld001f1

...and, to make the change "施行される", 圧力(をかける) enter.

(That's "ell", "dee", "無","無","one","eff","one"...(I'll explain in a moment. If you get a 汚い noise and a message 説 "構成要素 指名する... is not a valid identifier, look again at the first part of this paragraph. I bet you tried to use a 指名する that began with a digit. Must be a letter.)

(Alternatively, you can make the change 施行される by leaving the 指名する 所有物/資産/財産's edit box. (To do this, either 圧力(をかける) your "負かす/撃墜する arrow" cursor 支配(する)/統制する, or click, say, on "ParentBiDiMode" which is below and to the left. Don't click on ParentBiDiMode's edit box, which is 説 "True".))

In Lazarus programming, a 広大な/多数の/重要な 取引,協定 of it is about "反対するs". The Form is an 反対する. Every 反対する has a 指名する. And all the 指名するs follow the same 支配するs: Must start with a letter. No spaces.

As soon as you leave the "指名する" edit box, you may find that the two line "tree" in the pane at the 最高の,を越す of the 反対する 視察官 change.

For no 推論する/理由 that I can imagine, the tree structure 崩壊(する)s. Button1 is still there... click the symbol in 前線 of ld001f1.Tld001f1, and Button1:TButton will 再現する.

Look at the 肩書を与える 妨げる/法廷,弁護士業 of what used to be "Form1". You should now see "ld001f1".

At last! The 詳細(に述べる)s of saving your work...

Using the Lazarus main window menu, click "とじ込み/提出する | Save"

You should get a normal "Save As" dialog. Move around your disk to someplace sensible, e.g. your "My 文書s" folder. Make a folder for your Lazarus programming work. 地雷's called "Lazarus". And within that, make a folder called "LD001". The folder 指名する is 完全に up to you. Lazarus won't care.

"LD001": Lazarus デモ, number 001.

(If you call it LD1, you will 悪口を言う/悪態 yourself later... 信用 me)

If you want to use lower 事例/患者, for this, it is okay. You can call the folder "ld001".

You can have a second one called "LD001-second 試みる/企てる". Or any others, called anything. Whatever you do, though, stay 組織するd.

Once your LD001 folder is made, go into it. Save your 事業/計画(する)- not with the 示唆するd "project1.lpi", but rather, with "LD001.lpi". (If you are using this tutorial to learn Delphi programming, the 同等(の) 拡張 for that 環境 is .dpr). "Save as type" at the 底(に届く) of the dialog says *.lpi now, not what you may see in the illustration, if I 港/避難所't updated it.

As soon as you've done that, you'll be seeing....

Lazarus unit1 save

Save the 部隊 as "ld001u1", letting the system 供給(する) the appropriate ".pas" 拡張. Use lowercase letters. I think using 資本/首都s here can lead to 涙/ほころびs. Not sure, but why 危険 it? 指名する must start with a letter.

That's it! We should now have our work saved.

-----
Here's a recap of what we've done, and why....

We created a folder, once and for all, where our Lazarus work will go. We won't need to do this again, unless of course you want to subdivide your Lazarus work.

Within that, we created a folder for this Lazarus 事業/計画(する)... LD001: Lazarus Demo, number 001.

Each Lazarus 事業/計画(する) is made up of several parts. The 事業/計画(する)'s form, by my 条約, not by a Lazarus 必要物/必要条件, is given the 指名する of the 事業/計画(する), with "f1" (for form 1) tacked の上に it. We don't explicitly save the form's specification, by the way. It is saved for us along the way.

The first thing we saved, the one we called LD001.lpi (Lazarus 事業/計画(する) (警察などへの)密告,告訴(状)) saves an overview of the parts of our 事業/計画(する). Our little 事業/計画(する) was やめる simple. You'll see why we need an "overview" later on. (It is a text とじ込み/提出する, if you want to look at it with Notepad, or Textpad, or something 類似の.)

The second thing we saved was the code for our 使用/適用. Most of it was created for us by Lazarus, but we 与える/捧げるd....

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

The code (and, behind the scenes, the form it relates to) was saved in ld001u1.pas. (The "u1" 存在 for "部隊 1". The 指名する of the とじ込み/提出する with the code in it should only use digits and lower 事例/患者 letters. No spaces. No other punctuation 示すs... if you want to be "安全な". (There may be a few things you could use, but if you stick to these 制限s you won't have problems. I'm a little nervous about using upper 事例/患者 letters どこかよそで... that may have been a mistake... but I think I'm going to be able to use the upper 事例/患者 letters, except in the .pas とじ込み/提出する's 指名する, and they help me perceive what the 指名する is trying to say.

Now we have done our first "save" of the さまざまな bits of the 事業/計画(する), we can just click on the "Save" button (looks like a diskette) from time to time, and say "yes" if asked whether we want to save changes when we are shutting Lazarus 負かす/撃墜する. Or use ctrl-S to save.

I'm not going to tell you again: Save your work from time to time as you develop 使用/適用s.

Not やめる so often, but if you've got to a good point, without shutting your Lazarus work 負かす/撃墜する, go "out" to your operating system's normal とじ込み/提出する 管理/経営. Take a copy of the whole 事業/計画(する) folder (Windows: 権利 click on folder 指名する, select ""copy"), and paste the copy someplace sensible, with a sensible 指名する. (ctrl-v, 指名する "LD001BU-200518" for a 支援する Up made on 18 May, 2020")

Hurrah!

We have come a VERY long way. The most tedious "はうing" stuff is behind us.

Now we're going to make a more 利益/興味ing button. We're going to make the one that tells us the time when we click it.

Just as you did before, click on the button icon in the 構成要素 palette, and then click on the form.

You should now have two buttons on your form, "Button1" and "Button2".

Use the 反対する 視察官 to change the 指名するs of those 構成要素s to buQuit and buGiveTime それぞれ.

You can either click on the 反対する on the form to select it for the 反対する 視察官, or click on the 反対する's 指名する in the pane at the 最高の,を越す of the 反対する 視察官.

You should see "buQuit" and "buGiveTime" on the 直面するs of the buttons. While the 指名するs I've given them are good for what we need the 指名するs for, the buttons look silly with those geeky 指名するs. No problem.

Change the caption 所有物/資産/財産s of the buttons to "&やめる" and "&Give Time". 含む the ampersands and the space. (Do not 含む the quotation 示すs.)

(The ampersand means that if you 圧力(をかける) "Q" while the 使用/適用 is running, it is as good as clicking on buQuit. Already 圧力(をかける)ing "G" will also be as good as clicking on buGiveTime, but as that button doesn't do anything yet, you can't tell that. In Delphi, the ampersand would lead to the Q and the G 存在 を強調するd on the button. They are in the 反対する 視察官, if you look, but not on the 審査する. I was using Lazarus 0.9.30 at the time I 遭遇(する)d this, and it seems that it may be something that Lazarus wasn't doing "権利" やめる recently, so I'll 持つ/拘留する off fighting with it. If anyone knows how to make the を強調する appear, when the 環境 is Lazarus 0.9.30 and Windows XP, I'd be delighted to hear from you.)

Little 特別手当 factoids:

It is 平易な to lose windows from time to time...


-----
buGiveTime is supposed to give us the time. 二塁打 click on the button on the form, and the に引き続いて will appear in the Source Editor...

手続き Tld001f1.buGiveTimeClick(Sender: TObject);
begin

end;

挿入する the に引き続いて between the begin and the end...

showmessage('hello world');

... and run the 使用/適用, and click the "Give Time" button.

Hey, presto! A "Hello World" message! (井戸/弁護士席, you couldn't do your first program without an "Hello World"! It would have been prodigiously unlucky.)

Yes, I know... it was supposed to give the time, not "Hello World". Patience! We're getting there!

The showmessage() 手続き has its uses... but this is not a good 使用/適用 to use it in. You don't want to continually be 説 "承認する", do you?

No. So do this...

The fifth item on the 構成要素 Palette has "Abc" for its icon, and the pop-up says "TLabel". Click that, then click on your form.

Use the 反対する 視察官 to change the 指名する of that 反対する from Label1 to laAnswer. (Yes, I'm 存在 a little manic here about not just using the default 指名するs. It is a good habit to develop. 公式文書,認める the method in the 指名するing madness, by the way... Button 指名するs start "bu" and then a 資本/首都 letter; label 指名するs start "la", and then a 資本/首都 letter. As long as the 指名する starts with a letter and then has only letters and digits, Lazarus won't care what 指名するs you use. But the 条約 just given will be helpful. Try it. When you know the "支配するs" you can decide if you care to keep them.)

Go 支援する to where you put...

showmessage('hello world');

... and 取って代わる it with...

laAnswer.caption:='hello world';

Run the 使用/適用 again. Click the Give Time button. 冷静な/正味の! We are changing the value of a 所有物/資産/財産 of an 反対する while the 使用/適用 is running!

I'll say that again....

We are changing the value of a 所有物/資産/財産 (the caption 所有物/資産/財産) of an 反対する (the laAnswer 構成要素, which, as is every other 構成要素, is also an 反対する) while the 使用/適用 is running!

Not only that... but it only happens when we want it to... when the buGiveTime button is clicked.

冷静な/正味の!

支援する to work. Sorry.

公式文書,認める that we use ":=" as if those two characters were a 選び出す/独身 symbol to say "Change what's in laAnswer.caption to 'hello world'". The 結腸 wasn't a typo by me. We use ":=" for assignment. Later we will see things like if bTmp=5 then..., in which 事例/患者, with the equals 調印する on its own we will be asking if a 条件 of equality 存在するs.

Also be careful about semicolons. For now, just be sure to put them in when, and only when, you are told to. You'll learn the 支配するs, so you can decide for yourself, soon... but not in this essay... it is long enough already, isn't it?

Run the program again. Look at what's in laAnswer 最初. Click on buGiveTime, and what you see should change to 'hello world'

We're getting closer to our 宣言するd goal. This 過程 of starting with something simple, and building it up in bits is not, by the way, just for tutorials. When I 令状 a program, I take a 類似の approach. The art is in seeing what simple program has the elements that make it a useful basis fro what you have in mind. And in going there in 行う/開催する/段階s, with 効果的な 実験(する)ing of each 中間の 行う/開催する/段階. 平易な enough when you are at this level. Try doing it with a big 事業/計画(する).

Go 支援する to where you put...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

laAnswer.caption:='hello world'

... and 取って代わる it with...

laAnswer.caption:=DateTimeToStr(Now);

.. and run the 使用/適用.

We did it!!! (With a lot of help from Lazarus....)

The built in 機能(する)/行事 Now "returns", i.e. gives us, the 現在の date and time. But in a strange form... which you don't need to know much about happily, because....

DateTimeToStr() 変えるs things from the "strange form" of Now to the form useful to humans, and in a data type that is what a "caption" 所有物/資産/財産 needs.

The code...

DateTimeToStr(Now)

... is 遂行する/発効させるd in two steps, from "inside" to "outside". First Now 供給するs the date and time, in the "strange form", and then that is 変えるd, by DateTimeToStr to what laAnswer.caption:= needs.

Hard to explain. Hard to しっかり掴む, on first 知識... but you'll soon be using what is going on there without even thinking about it!

Yes, but how do you know there's the "Now" 機能(する)/行事, let alone the other one?

Lots of time in the Lazarus documentation and 会議. 一般に: If you've seen something in someone else's 使用/適用, there's a way to do it in Lazarus.


All that's left... (^_^)

When you've mastered the above, you will know a 重要な 部分 of the basic 技術s you need for working with Lazarus. It may not feel like it at the moment, but you've made tremendous 進歩. You'll need to learn about some of the other the 反対するs 利用できる from the 構成要素 Palette... but nothing like all of them. You'll need to learn about many of their 所有物/資産/財産s, but again, not all of them. You'll need to learn more of the built in 機能(する)/行事s and 手続きs, like Now and DateTimeToStr()....

But you have already heard about many of the basic 技術s and 概念s that you will need.

Finally....

Just to whet your appetite, and to be sure you didn't 行方不明になる an important thing implicit in what you've done...

One big area we've hardly touched on: Events and their handlers. You have 現実に used one, the OnClick event of the buttons. And you created two handlers: One to 扱う the clicking of buQuit, one to 扱う the clicking of buGiveTime. But I will 許す you if you don't yet fully understand events and event 扱うing. You'll get lots of help with that later.

The 広大な/多数の/重要な thing is that you are now ready to work through more tutorials, and now you have the 技術s to be developing 使用/適用s while you do those tutorials. They will be a lot more fun than this one was! (Hardly likely to be いっそう少なく fun?)




Search across all of my 場所/位置s with a Google search button. There's one on another of my pages. (It's at the 最高の,を越す of the page the link will take you to.)

Or...

Use this to search THIS 場所/位置.... (Go to my other 場所/位置s, below, and use their search buttons if you want to search them.)

索引 sitemap 前進するd
search engine by freefind

場所/位置 地図/計画する    What's New    Search

The search engine 単に looks for the words you type, so....
*    (一定の)期間 them 適切に.
*    Don't bother with "How do I get rich?" That will 単に return pages with "how", "do", "I"....

Please also 公式文書,認める that I have two other 場所/位置s, and that this search will not 含む them. They have their own search buttons.

My SheepdogSoftware.co.uk 場所/位置.

My 場所/位置 at Arunet.



広告 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 has been 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org. Mostly passes.

AND passes... Valid CSS!

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 .....