Sign in Join
Wiki copytemporary

Lazarus Tutorial/ja: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11*このLazarusチュートリアルに、遠慮なくあなたの経験を書き加えてみませんか? どうぞご遠慮なく。*
22
33## 概要
44
55Lazarusは Free Pascal コンパイラのためのフリーでオープンソースな開発ツールです。 Lazarus IDEは、機能が豊富なプログラム環境であり、単独で機能するGUIアプリケーションやコンソールアプリケーションを開発できます。 Lazarusは、現在 Linux、 FreeBSD、 Win32 そして Mac OS X の上で動作し、カスタマイズ可能なソースエディタ、FreePascalコンパイラと統合された完全なGUI、 パッケージマネージャやデバッガを持つビジュアルなフォーム作成環境を提供します。
66
7-<figure>
8-<img src="Laz_ScreenShot_ja.png" title="スクリーンショット" />
9-<figcaption>スクリーンショット</figcaption>
10-</figure>
7+![](/wiki-images/0/03/Laz_ScreenShot_ja.png)
118
129## Lazarusでプログラムをはじめてみよう
1310
1411[[Installing Lazarus/ja|Lazarusをインストールして]]、起動してみてください。これだけで、Free PascalやLazarusをつかったプログラムをはじめてみることができます。
1512
1613起動すると、いくつかのウィンドウがデスクトップ上に現れます。上の方にはメインメニューがあります。左には、**[[IDE Window: Object Inspector/ja|オブジェクトインスペクタ]]**あります。そのほかのデスクトップの大部分は、**[[source code editor/ja|ソースコードエディタ]]**です。多分Form1ウィンドウが作られていて、ソースエディタに重なっているはずです。
1714
1815上の方にあるメニューウィンドウの、メニューの下にタブの列があります。'標準'タブが選択されていますね。そこでButtonアイコン(四角の中に「OK」と書いてあるもの)を探してクリックしてください。そして、Form1の上の左中央あたりでクリックしてください。すると'Button1'と書かれた四角い図形(=ボタンです)が現れるはずです。もう一回標準タブのButtonアイコンをクリックして、Form1の右中央でクリックしてください。'Button2'と書かれたボタンが現れます。
1916
2017Button1をクリックしましょう。オブジェクトインスペクタに、オブジェクトButton1のプロパティが表示されます。'Caption'と名付けられたプロパティに'Button1'と表示されていますね。その部分をクリックして'Button1'を'Press'に書き換えてください。あなたがENTERキーを押すか、別のボックスをクリックすれば、最初にForm1に置いたボタンが'Press'という名前になります。 続いて、オブジェクトインスペクタ上のイベントタブをクリックすると、ボタンに関連付けられている色々なイベントを見ることができます。 イベントには、たとえば、OnClick、OnEnter、OnExitなどがあります。OnClickボックスの右側を選択してください。小さなボックスが...と一緒に表示されます。あなたがこれをクリックすれば、自動的にソースエディタに移動してカーソルはコードの開始部分に移動します。
2118
2219``` pascal
2320 procedure TForm1.Button1Click(Sender: TObject);
2421 begin
2522 {ここで次のように入力:} Button1.caption := 'Press again';
2623 {エディタは、このプロシージャ名を補完しました。}
2724 end;
2825```
2926
3027と入力したら、F12を押してソースエディタから出てForm1ウィンドウを選択してください。
3128
3229続いてButton2のプロパティを編集します。Button2をクリックして、プロパティをオブジェクトインスペクタに表示させてください。Captionプロパティを変更して'Button2'から'Exit'にします。イベントタブを選択して、OnClickボックスをクリックしてください。...をクリックして、ソースエディタに入り、真ん中あたりのプロシージャに
3330
3431``` pascal
3532 procedure TForm1.Button2Click(Sender: TObject);
3633 begin
3734 {ここで次のように入力:} Close;
3835 {エディタは、このプロシージャ名を補完しました。}
3936 end;
4037```
4138
4239こう書いて、もう一度F12を押してForm1ウィンドウに戻ります。 これで、コンパイルを試みる段階まで来ました。コンパイルはとても簡単です。メインメニューにある'実行'を選択するだけです。 サブメニューで'実行'のオプションを選ぶこともできます。 また、単純にF9を押しても行えます。最初のコンパイルが行われ(うまくいけば)、リンクが完了し、コンパイルされたプログラムが実行されます。
4340
4441複数のテキストウィンドウが現れてすべてのコンパイラメッセージが表示され、その後はForm1ウィンドウが現れますが、グリッドの点は表示されません。これはあなたのアプリケーションのメインウィンドウであり、あなたがボタンを押すか他の方法で操作をするのを待っています。
4542
4643では'Press'と書かれたボタンを押してみましょう。あなたはそれが'Press again'と変わることに気づくでしょう。あなたがそれをもう一度押してもそれは'Press again'でしょう!!
4744
4845'Exit'のボタンも押してみます。ウィンドウが閉じてプログラムが終了します。オリジナルのForm1ウィンドウがドットによるグリッドとともに表示され、編集可能な状態になります。
4946
5047それではこれまでの作業を保存しておきましょう(これは頻繁に行いましょうね!!)。プロジェクトメニュー \> 別名で保存 \> your_selected_file_name.pas(適当な名前を付けます)とすれば完了です。これで、プログラムを終了して、PCの電源を切っても、保存したところから作業を再開できます。
5148
5249### プログラムを変更する
5350
5451先ほど保存しておいた、プロジェクトを開いてください。 Form1ウィンドウにある'Press'ボタンをクリックして、選択してください。 オブジェクトインスペクタのイベントタブを選択して、OnClickボックスの右側をクリックして、ソースエディタの適切な位置に戻りましょう。
5552
5653次に続くコードを参考に、さきほどのコードを書き直してみてください。
5754
5855``` pascal
5956 procedure TForm1.Button1Click(Sender: TObject);
6057 {TButtonのTagプロパティを使います。ここでは0か1の値を設定しています。}
6158 begin
6259 if Button1.tag =0 then
6360 begin
6461 Button1.caption := 'Press again';
6562 Button1.tag := 1
6663 end else
6764 begin
6865 Button1.caption := 'Press';
6966 Button1.tag := 0
7067 end
7168 end;
7269```
7370
7471保存し、もう一度コンパイルして実行しましょう。このコードによって、左側のボタンを押すと、今度はふたつのメッセージを交互に表示するようになりました。
7572
7673さあ、後は自由に工夫してみてください。
7774
7875もし、このようなGUIをもつプログラムでなく、たとえばあなたが基本的なPascalプログラミングを試してみたい、とかバッチモードで動作するプログラムを書く必要がある、とかシステムプログラミングをしたいとかそういう時には、コンソールやテキストベースのPascalプログラムを書く場面があるかもしれません。
7976
8077そんな時にも、プログラムを編集、コンパイル、実行するために、Pascalの統合開発環境としてLazarusを使うことができます。 LazarusはPascalによる開発のための理想的な環境を作ります。詳しくは[[Console Mode Pascal/ja|コンソールモードPascalをご]]覧ください。
8178
8279## エディタのウインドウ
8380
8481Lazarusを起動すると、いくつかに分割されている'フローティング'ウィンドウが、あなたのデスクトップ上に現れます。
8582
8683デスクトップ右上に、**Lazarus Editor vXXXXXX - project1**(これはあなたが現在開いているプロジェクトの名前になります)とタイトルに書かれたものが表示されています。
8784
8885これがプロジェクトのメインコントロールウィンドウで、メインメニューとコンポーネントパレットを含んでいます。
8986
90-<center>
91-
92-<figure>
93-<img src="LazMain_ja.png" title="LazMain_ja.png" />
94-<figcaption>LazMain_ja.png</figcaption>
95-</figure>
96-
97-</center>
87+![](/wiki-images/2/2f/LazMain_ja.png)
9888
9989タイトルバー下のラインは*メインメニュー*でファイル、編集、検索、表示メニューなどを含んでおり、Lazarusの基本的な操作をおこなえます。
10090
10191この下に一組のビットボタン(よく使うメニューアイテムへのショートカットになっています)があり、その右側にはコンポートネントパレットがあります。
10292
10393Lazarus Editorウィンドウの下には**[[IDE Window: Object Inspector/ja|オブジェクトインスペクタ]]**が左側に、 **[[source code editor/ja|ソースコードエディタ]]**が右側にあります。他に小さな窓があり、**[Form1](http://lazarus-ccr.sourceforge.net/kbdata/blankform.jpg)**と名付けられていてLazarusソースエディタウィンドウの上に覆いかぶさっているでしょう。これが見えなければ**F12**キーを押すことですぐに画面上に復帰させることができます。 Formウィンドウはあなたのアプリケーションのグラフィカルインターフェイスを作成するためにあり、ソースエディタはあなたのアプリケーションのPascalコードを表示します。The operation of the Object Inspector is discussed in more detail below while the Component Palette is described.
10494
10595あなたが新しいプロジェクトを始めるとき、(Lazarusもしくはあなたが最初にLazarusを起動するとき)デフォルトのフォームが既に作成されていることでしょう。ここにはドットでグリッドが描かれており、あなたがコンポーネントをフォームに配置するときの手助けをします。そしてタイトルバーには**最小化**、 **最大化** そして **閉じる**のボタンがあります。もし あなたがこのウィンドウをクリックすればデスクトップの左側にあるオブジェクトインスペクタにこのフォームのプロパティが表示されます。
10696
10797他のウィンドウが貴方の作業中に目にはいるようになることもあるでしょう。 **[プロジェクトインスペクタ](http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg)**はあなたのプロジェクトの詳細と、関連するファイルを表示し、またファイルの追加や削除を行うことができます。**メッセージウィンドウ** は貴方のプロジェクトに関するコンパイラからのメッセージやエラー、もしくは進行状態を表示します。もしもLazarusをターミナルウィンドウから起動しているなら、本来ターミナルに表示されるべきことがらや、コンパイラメッセージの詳細が出力されます。
10898
10999## メインメニュー
110100
111101Lazarus IDEのメインメニューからアクセスできるすべてのメニューアイテムの詳細な説明については、[[Main menu/ja|Main menu/jaページを]]参照してください。
112102
113103## IDE クールバー
114104
115-<figure>
116-<img src="ide_coolbar.png" title="ide_coolbar.png" />
117-<figcaption>ide_coolbar.png</figcaption>
118-</figure>
105+![](/wiki-images/d/d3/Ide_coolbar.png)
119106
120107メインコントロールウィンドウの左側、メインメニューの直下、コンポーネントパレットの左にIDEクールバーがあります。ここには、メインメニューの中でよく用いられる機能のボタンがあります:
121108
122109
123110**新規ユニット**、**開く** (ボタン右側の下向き矢印を押すと最近扱ったファイルの一覧が表示されます)、**保存**、**すべて保存**、**新規フォーム**、**フォーム/ユニット切り替え**(フォームかユニットのソースコードを表示)、**ユニットを表示**、**フォームを表示**、**実行**(コンパイルして実行)、**一時停止**、**トレース実行**、**ステップ実行**(最後の2つはデバッガの機能)
124111
125112## コンポーネントパレット
126113
127114コンポーネントパレットとは、多くのアイコンが並んだタブ付きのツールバーのことです。各アイコンは、フォームを作成する際によく用いられるコンポーネントを表しています。
128115
129-<figure>
130-<img src="Component_Palette_Standard.png" title="size=&quot;100%" />
131-<figcaption>size="100%</figcaption>
132-</figure>
116+![](Component_Palette_Standard.png "size="100%")
133117
134118それぞれのタブは機能ごとに分けられており、異なった組のアイコンからなります。 全てのタブでは、一番左に矢印のアイコンがあります。これは選択ツール(Selection Tool)と呼びます。
135119
136120マウスカーソルをコンポーネントパレットのアイコンの上に移動して、しばらくクリックしないで待つと、アイコンが意味するコンポーネントの名前がポップアップします。 それらの名前がすべて 'T' で始まることに注意してください。これは、そのコンポーネントの 「型:'Type'」 、正確に言うとコンポーネントの 「クラス:'Class'」 を示しています。
137121
138122コンポーネントをフォームに加えると、その [[Class]] が [[Unit]] の **[[Interface]]** 部の **[[Type]]** セクションに追加されます。(通常は TForm1 の定義の一部として) 同時に、そのクラスの **instance** が **[[Var]]** セクションに加えられます(通常、Form1という名前の変数として)。 フォームやコンポーネントが用いる **Methods** は、全て(つまり全ての [[Procedure]] と [[Function]] )、そのユニットの **[[Implementation]]** 部で宣言する必要があります。
139123
140124#### コンポーネントのサンプルプログラム
141125
142126コンポーネントのサンプルプログラムは、 \$LazarusPath/lazarus/examples に保存されています。
143127
144128多くのプログラムで、IDEやコンポーネントパレットを使わないでダイアログや他のコンポーネントを利用する方法が分かるでしょう。全てのコンポーネントは、明確に主となるpascalプログラムで定義されています。 IDEを大いに利用するサンプルもあります。
145129
146130サンプルプログラムの中には、そのままでは動作しないものもあるでしょう。ファイルやディレクトリのパス、パーミッションを設定する必要があるかも知れません。サンプルプログラムをコンパイルするにあたり、ファイル及びディレクトリに対する 読み/書き/実行 (read/write/execute) のパーミッションを確認して下さい。または適切なパーミッションを持ったディレクトリにファイルをコピーしてください。
147131
148132まずは、'testall' プログラムを実行してみましょう。利用可能なコンポーネントのメニューと簡単な実行例があります。コードを読んでどう動いているか調べてみましょう!
149133
150134#### コンポーネントの一覧
151135
152136コンポーネントの一覧を以下に示します。各ユニットには、それらの解説するページへのリンクが張ってあります(ないのもあります)。 あるコンポーネントのプロパティについて知りたければ、そのコンポーネントの継承を調べ、継承元となるコンポーネントについて調べるとよいでしょう。 例えば、TMaskEdit について理解することは、 TCustomMaskEditについて調査する際にも役に立ちます。
153137
154138**タブの名前** (タブ自体の名前がおよその説明になっています。)
155139
156140- **[Standard](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/index-4.html)**(基本:コンポーネントの記述は、[[Standard tab/ja|Standard タブ]] にあります)。
157141
158-<center>
159-
160-<figure>
161-<img src="Component_Palette_Standart.png" title="Component_Palette_Standart.png" />
162-<figcaption>Component_Palette_Standart.png</figcaption>
163-</figure>
164-
165-</center>
142+![](/wiki-images/4/4d/Component_Palette_Standart.png)
166143
167144
168145[TMainMenu](http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html), [TPopupMenu](http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html), [TButton](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html), [TLabel](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html), [TEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html), [TMemo](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html), [TToggleBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html), [TCheckBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html), [TRadioButton](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html), [TListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html), [TComboBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html), [TScrollBar](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html), [TGroupBox](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html),[TRadioGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html), [TCheckGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html), [TPanel](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html), [TActionList](http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html)
169146
170147- **[Additional](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/index-4.html)** (追加:コンポーネントの自体は、[[Additional tab/ja|Additionalタブ]] もご覧下さい。)
171148
172-<center>
173-
174-<figure>
175-<img src="Component_Palette_Additional.png" title="Component_Palette_Additional.png" />
176-<figcaption>Component_Palette_Additional.png</figcaption>
177-</figure>
178-
179-</center>
149+![](/wiki-images/7/7d/Component_Palette_Additional.png)
180150
181151
182152[TBitBtn](http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html), [TSpeedButton](http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html), [TStaticText](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html), [TImage](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html), [TShape](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html), [TBevel](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html), [TPaintBox](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html), [TNotebook](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html), [TLabeledEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html), [TSplitter](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html), [TTrayIcon](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttrayicon.html), [TMaskEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/maskedit/tmaskedit.html), [TCheckListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html), [TScrollBox](http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscrollbox.html), [TApplicationProperties](http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html), [TStringGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html), [TDrawGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html), [TPairSplitter](http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html), [TColorBox](http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorbox.html), [TColorListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorlistbox.html), [TChart](http://lazarus-ccr.sourceforge.net/docs/lcl/chart/index.html)
183153
184154- **[Common Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/index-4.html)** (コンポーネントの記述は、 [[Common Controls tab]] にあります。)
185155
186-<center>
187-
188-<figure>
189-<img src="Component_Palette_Common_Controls.png" title="Component_Palette_Common_Controls.png" />
190-<figcaption>Component_Palette_Common_Controls.png</figcaption>
191-</figure>
192-
193-</center>
156+![](/wiki-images/4/4a/Component_Palette_Common_Controls.png)
194157
195158
196159[TTrackBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttrackbar.html), [TProgressBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tprogressbar.html), [TTreeView](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttreeview.html), [TListView](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tlistview.html), [TStatusBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tstatusbar.html), [TToolBar](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttoolbar.html), [TUpDown](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tupdown.html), [TPageControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tpagecontrol.html), [TTabControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttabcontrol.html), [THeaderControl](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/theadercontrol.html), [TImageList](http://lazarus-ccr.sourceforge.net/docs/lcl/controls/timagelist.html), [TPopupNotifier](http://lazarus-ccr.sourceforge.net/docs/lcl/popupnotifier/index.html)
197160
198161- **[Dialogs](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/index-4.html)** (コンポーネントの記述は、 [[Dialogs tab]] にあります。)
199162
200-<center>
201-
202-<figure>
203-<img src="Component_Palette_Dialogs.png" title="Component_Palette_Dialogs.png" />
204-<figcaption>Component_Palette_Dialogs.png</figcaption>
205-</figure>
206-
207-</center>
163+![](/wiki-images/7/72/Component_Palette_Dialogs.png)
208164
209165
210166[TOpenDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/topendialog.html), [TSaveDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tsavedialog.html), [TSelectDirectoryDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tselectdirectorydialog.html), [TColorDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcolordialog.html), [TFontDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfontdialog.html), [TFindDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfinddialog.html), [TReplaceDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/treplacedialog.html), [TOpenPictureDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/topenpicturedialog.html), [TSavePictureDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tsavepicturedialog.html), [TCalendarDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalendardialog.html), [TCalculatorDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalculatordialog.html), [TPrinterSetupDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html), [TPrintDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintdialog.html), [TPageSetupDialog](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html)
211167
212168パレットに含まれていませんが、他にもいくつかの便利な **[ダイアログ](http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples)**手続きや関数があります。それらはソースプログラムから直接に呼び出せ、簡単に利用できます。
213169
214170- **Misc**(その他)
215171
216-<center>
217-
218-<figure>
219-<img src="Component_Palette_Misc.png" title="Component_Palette_Misc.png" />
220-<figcaption>Component_Palette_Misc.png</figcaption>
221-</figure>
222-
223-</center>
172+![](/wiki-images/8/8e/Component_Palette_Misc.png)
224173
225174
226175[TColorButton](http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt), [TSpinEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tspinedit.html), [TFloatSpinEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tfloatspinedit.html), [TArrow](http://lazarus-ccr.sourceforge.net/docs/lcl/arrow/tarrow.html), [TCalendar](http://lazarus-ccr.sourceforge.net/docs/lcl/calendar/tcalendar.html), [TEditButton](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/teditbutton.html), [TFileNameEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tfilenameedit.html), [TDirectoryEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdirectoryedit.html), [TDateEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.html), [TCalcEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tcalcedit.html), [TFileListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/filectrl/tfilelistbox.html), [TXMLPropStorage](http://lazarus-ccr.sourceforge.net/docs/lcl/xmlpropstorage/txmlpropstorage.html), [TIniPropStorage](http://lazarus-ccr.sourceforge.net/docs/lcl/inipropstorage/tinipropstorage.html), [TBarChart](http://lazarus-ccr.sourceforge.net/docs/lcl/chart/tbarchart.html), [TButtonPanel](http://lazarus-ccr.sourceforge.net/docs/lcl/buttonpanel/tbuttonpanel.html), TIDEDialogLayoutStorage
227176
228177- **[Data Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/index-4.html)**(データの制御。Standard及びAdditionalグループに似ていますが、データベースに適用できます)
229178
230-<center>
231-
232-<figure>
233-<img src="Component_Palette_DataControls.png" title="Component_Palette_DataControls.png" />
234-<figcaption>Component_Palette_DataControls.png</figcaption>
235-</figure>
236-
237-</center>
179+![](/wiki-images/6/62/Component_Palette_DataControls.png)
238180
239181
240182[TDBNavigator](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbnavigator.html), [TDBText](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbtext.html), [TDBEdit](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbedit.html), [TDBMemo](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbmemo.html), [TDBImage](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbimage.html), [TDBListBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdblistbox.html), [TDBComboBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcombobox.html), [TDBCheckBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcheckbox.html), [TDBRadioGroup](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbradiogroup.html), [TDBCalendar](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcalendar.html), [TDBGroupBox](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbgroupbox.html), [TDBGrid](http://lazarus-ccr.sourceforge.net/docs/lcl/dbgrids/tdbgrid.html)
241183
242184- **Data Access**(データへのアクセス)
243185
244-<center>
245-
246-<figure>
247-<img src="Component_Palette_DataAccess.png" title="Component_Palette_DataAccess.png" />
248-<figcaption>Component_Palette_DataAccess.png</figcaption>
249-</figure>
250-
251-</center>
186+![](/wiki-images/c/cc/Component_Palette_DataAccess.png)
252187
253188
254189TDatasource, TMemDataset, TSdfDataSet, TFixedFormatDataSet, TDbf
255190
256191- **System**(システム)
257192
258-<center>
259-
260-<figure>
261-<img src="Component_Palette_System.png" title="Component_Palette_System.png" />
262-<figcaption>Component_Palette_System.png</figcaption>
263-</figure>
264-
265-</center>
193+![](/wiki-images/f/fe/Component_Palette_System.png)
266194
267195
268196[TTimer](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttimer.html), [TIdleTimer](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tidletimer.html), [TLazComponentQueue](http://lazarus-ccr.sourceforge.net/docs/lcl/lresources/tlazcomponentqueue.html), [THtmlHelpDatabase](http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlhelpdatabase.html), [THtmlBrowserHelpViewer](http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlbrowserhelpviewer.html), [TProcessUTF8](http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tprocessutf8.html), [TAsyncProcess](http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tasyncprocess.html), [[doc:fcl/process/tprocess.html|TProcess]], TSimpleIPCClient, TSimpleIPCServer, TXMLConfig, TEventLog
269197
270198- **SynEdit**(SynEdit:他の言語や開発ツールへのインターフェースとなるコンポーネント[sourceforge](http://synedit.sourceforge.net/))
271199
272-<center>
273-
274-<figure>
275-<img src="Component_Palette_SynEdit.png" title="Component_Palette_SynEdit.png" />
276-<figcaption>Component_Palette_SynEdit.png</figcaption>
277-</figure>
278-
279-</center>
200+![](/wiki-images/2/22/Component_Palette_SynEdit.png)
280201
281202
282203TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynFreePascalSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynVBSyn, TSynAnySyn, TSynMultiSyn
283204
284205SynEditは、 Borland Delphi, Kylix と C++Builder用の複数行編集コントロールであり、文法ハイライト機能やコード補完機能、HTMLやTeX、RTFへのエクスポート機能を持っています。これは完全なVCL/CLXコントロールであり、Microsoft Windows のコントロールのラッパーではなく、ランタイムライブラリを必要としない、クロスプラットフォームで利用できるコンポーネントです。FreePascalとの互換性も計画されており、 Lararus IDE をエディタも SynEditが利用されています。[sourceforge](http://synedit.sourceforge.net/)も参照ください。
285206
286207#### コンポーネントパレットの使い方
287208
288209コンポーネントパレットの利用にあたっては、フォームが作成されており、エディタ上で見えている必要があります(フォームが無い場合は、 File -\> New Form で新たなフォームが作成してください)。 次に、使いたいコンポーネントのアイコンをクリックして選択し、フォーム上のコンポーネントを配置したい位置でクリックすることで、選択されたコンポーネントが配置されます。 コンポーネントの移動やサイズの調整は、マウスで直接操作することでもできますし、コンポーネントのプロパティの値をオブジェクトエディタから直接操作することでもできます。
289210
290211コンポーネントを新たに追加したときには(自作や他のパッケージから追加するなど)、コンポーネントパレットに新しいタブが現れ、コンポーネントに応じたアイコンが表示されます。それらは他のコンポーネントと同様に使用できます。
291212
292213## デバッガ
293214
294215
295216(まだ書かれていません)
296217
297218## Lazarusのファイルについて
298219
299220ファイルの保存操作をすると、次の二つのファイルを保存することになります:
300221
301222`  xxx.pas`\
302223`  yyy.lpr `
303224
304225他にも保存されるファイルはありますが、あなたが名前をつけられるのはこの二つです。 プロジェクトファイル (lpr) 及びユニットファイル (pas) は同じ名前であってはいけません。Lazarus はユニットの名前(ソースコードに現れる名前)をユニットファイル名(xxxの部分)と同じになるように、またプログラムの名前をプロジェクトファイル名(yyyの部分)と同じになるように設定するので、同じになっていると、プロジェクト中で識別子が重複してしまいます。 一貫性を維持するため、project1 や、unit1 に適当な名前をつけましょう。
305226
306227たとえば、**again** という名前のプロジェクトを保存しようとする際に、again.pas と again.lpr という名前で保存しようとするとうまくいきません。ユニット名とプログラム名は同じプロジェクト中にあるため、名前が重複したというエラー duplicate name error になります。
307228
308229そこで、次のようになりました:
309230
310231e:/lazarus/kj/lazhello:
311232
312233`total 4740  free 76500`\
313234`-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe`\
314235`-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi`\
315236`-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr`\
316237`-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm`\
317238`-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs`\
318239`-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas`\
319240`-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu`\
320241`-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat`
321242
322243二つのファイル (again.lpr、againu.pas) を保存したと思っていたのに、もっと多くのファイルが保存されています。
323244
324245それぞれのファイルの簡単な説明をしておきましょう:
325246
326247**again.exe:**
327248メインプログラムのバイナリ実行ファイルです。Win32では拡張子"exe"がつきます。Linux(やMac OS X)では何もつきません。デバッグ用のシンボルを含むために、Linuxでは巨大なファイルになります。"strip"コマンドでそれらを除去すると実行ファイルを小さくすることができます。
328249
329250**again.lpi:**
330251Lazarus プロジェクトのメインファイルです (Lazarus Project Information); Delphi でこれと同等なものが .dpr です。このファイルは XML フォーマットで保存されます。
331252
332253**again.lpr:**
333254メインプログラムのソースファイルです。Lazarus特有の拡張部分を除くと、実際にはごく普通の Pascal ソースファイルです。
334255
335256uses節があり、コンパイラはその記述に従って必要な全ユニットを見つけます。Program 宣言の名前はファイル名と一致する必要があります。
336257
337258**againu.lfm:**
338259フォームユニットのレイアウトを格納します。Lazarus はこれを用いてリソースファイルを生成し、それが againu.pas の初期化セクション でインクルードされます。 Lazarus IDE の Tools-\>Convert DFM file to LFM utility を用いると、Delphi の dfm ファイルをlfmに変換することができます。
339260
340261**againu.lrs:**
341262生成されたリソースファイルです。Windows のリソースファイルとは異なります。
342263
343264**againu.pas:**
344265このユニットにフォームのコードを書きます。
345266
346267**againu.ppu:**
347268ユニットをコンパイルしたオブジェクトコードです。
348269
349270**ppas.bat:**
350271プログラムをリンクし実行ファイルを作るための簡単なスクリプト(バッチファイル)です。コンパイルが成功すれば、コンパイラによって削除されます。
351272
352273## Original contributors and changes
353274
354275This page has been imported from the epikwiki [version](http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial).
355276
356277- Created initial page and template. T. Lisjac - 11/04/2003 VlxAdmin
357278- Inserted a note containing instructions for writing your first Lazarus Program. Suggest an administrator places it in the appropriate place on the Tutorial menu. 3/09/2004 User:Kirkpatc
358279- Per above, moved Chris's writeup to the main body of the tutorial VlxAdmin
359280- Began to insert text describing the Lazarus Editor - more to follow! 24 Mar 2004 User:Kirkpatc
360281- Added some more to Lazarus Editor section of Tutorial. 25 Mar 2004 User:Kirkpatc
361282- Added screenshots and revised some of the page formatting VlxAdmin 3/25/2004
362283- Moved some of kwhitefoot's comments into Tutorial section. Formatting not quite right, but have to go to bed now! 26 Mar 2004 User:Kirkpatc
363284- Formatted, added credits and comments. Removed original notes. VlxAdmin 3/26/2004
364285- More material added to Editor section of tutorial. 26 Mar 2004 User:Kirkpatc
365286- More material added describing the Main Menu. Renamed 'Hello World' to 'Getting Started' and moved it to nearer the top. 31 March 2004 User:Kirkpatc
366287- Inserted section on Run sub-menu. Some general editing (eg ended each entry with a period to ensure consistency). 9 Apr 2004 User:Kirkpatc
367288- Inserted a new section on How to get started with MySQL in FPC/Lazarus. 13 Apr 2004 User:Kirkpatc
368289- Deleted the section on MySQL from here: it has been copied to Lazarus Database section of tutorial. 14 Apr 2004 User:Kirkpatc
369290- Added some more to the description of the Editor Main Menu. 18 Apr 2004 User:Kirkpatc
370291- Added section on Environment sub-menu. 19 Apr 2004 User:Kirkpatc
371292- Added section on Components sub-menu. 4 May 2004 User:Kirkpatc
372293- Adding Tools sub-menu description (incomplete). 7 May 2004 User:Kirkpatc
373294- Added some screenshots to Menu descriptions. 9 May 2004 User:Kirkpatc
374295- Fixed a bit in Environment Options - thanks VincentSnijders. 14 May 2004 User:Kirkpatc
375296- More additions to Tools sub-menu. 19 May 2004 User:Kirkpatc
376297- Added a section on the Button Bar and started work on The Component Palette. 20 May 2004 User:Kirkpatc
377298- Posted a description file for the StdCtrls unit of the LCL, in the hope that people will add comments. 26 May 2004 User:Kirkpatc
378299- Edited the StdCtrls file, removing a lot of repetitive material and doing some formatting. It is still far too long. 28 May 2004 User:Kirkpatc
379300- Expanding on the Components Palette. 5 June 2004 User:Kirkpatc
380301- Added a lot to the DialogExamples page. 10 June 2004 User:Kirkpatc
381302- Considerable revision of the StdCtrls page, hopefully making it clearer and encouraging people to contribute - particularly in the 'Description' sections. 14 June 2004 User:Kirkpatc
382303- Added pages for Menus and Dialogs units (linked to Component Palette description) - please feel free to add to these pages. 14 June 2004 User:Kirkpatc
383304- Added page for Common Controls (linked to Component Palette). 16 June 2004 User:Kirkpatc
384305- Added MaskEdit page (linked to Component Palette). 17 June 2004 User:Kirkpatc
385306- Added Buttons, ExtCtrls pages (linked to Component Palette). 17 June 2004 User:Kirkpatc
386307- Edited MainMenu component description page. 23 June 2004 User:Kirkpatc
387308- Some additions to Common Controls. 28 June 2004 User:Kirkpatc
388309- A new tutorial on Text-mode Pascal programming has been added. 5 July 2004 User:Kirkpatc
389310- Minor changes to ComCtrls, ExtCtrls, Environment Menu. 10 July User:Kirkpatc
390311- Added FormsTxt, component description page for Component Palette. 20 July 2004 User:Kirkpatc
391312- Some corrections to ConsoleModePascal. 21 July 2004 User:Kirkpatc
392313- Some small changes to ComponentPalette. 22 July 2004 User:Kirkpatc
393314- Some edits and additions to the Lazarus Component section. 23th Jan 2009 User: Miyatake
394315
395316---
396317*From the Free Pascal wiki, page "Lazarus Tutorial/ja", as it stood on 2024-03-30 after a change by Ariben, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history