Sign in Join
Wiki copytemporary

Lazarus Tutorial/ja: what changed

Revision 2 to 3. 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
77![](/wiki-images/0/03/Laz_ScreenShot_ja.png)
88
99## Lazarusでプログラムをはじめてみよう
1010
1111[[Installing Lazarus/ja|Lazarusをインストールして]]、起動してみてください。これだけで、Free PascalやLazarusをつかったプログラムをはじめてみることができます。
1212
1313起動すると、いくつかのウィンドウがデスクトップ上に現れます。上の方にはメインメニューがあります。左には、**[[IDE Window: Object Inspector/ja|オブジェクトインスペクタ]]**あります。そのほかのデスクトップの大部分は、**[[source code editor/ja|ソースコードエディタ]]**です。多分Form1ウィンドウが作られていて、ソースエディタに重なっているはずです。
1414
1515上の方にあるメニューウィンドウの、メニューの下にタブの列があります。'標準'タブが選択されていますね。そこでButtonアイコン(四角の中に「OK」と書いてあるもの)を探してクリックしてください。そして、Form1の上の左中央あたりでクリックしてください。すると'Button1'と書かれた四角い図形(=ボタンです)が現れるはずです。もう一回標準タブのButtonアイコンをクリックして、Form1の右中央でクリックしてください。'Button2'と書かれたボタンが現れます。
1616
1717Button1をクリックしましょう。オブジェクトインスペクタに、オブジェクトButton1のプロパティが表示されます。'Caption'と名付けられたプロパティに'Button1'と表示されていますね。その部分をクリックして'Button1'を'Press'に書き換えてください。あなたがENTERキーを押すか、別のボックスをクリックすれば、最初にForm1に置いたボタンが'Press'という名前になります。 続いて、オブジェクトインスペクタ上のイベントタブをクリックすると、ボタンに関連付けられている色々なイベントを見ることができます。 イベントには、たとえば、OnClick、OnEnter、OnExitなどがあります。OnClickボックスの右側を選択してください。小さなボックスが...と一緒に表示されます。あなたがこれをクリックすれば、自動的にソースエディタに移動してカーソルはコードの開始部分に移動します。
1818
1919``` pascal
2020 procedure TForm1.Button1Click(Sender: TObject);
2121 begin
2222 {ここで次のように入力:} Button1.caption := 'Press again';
2323 {エディタは、このプロシージャ名を補完しました。}
2424 end;
2525```
2626
2727と入力したら、F12を押してソースエディタから出てForm1ウィンドウを選択してください。
2828
2929続いてButton2のプロパティを編集します。Button2をクリックして、プロパティをオブジェクトインスペクタに表示させてください。Captionプロパティを変更して'Button2'から'Exit'にします。イベントタブを選択して、OnClickボックスをクリックしてください。...をクリックして、ソースエディタに入り、真ん中あたりのプロシージャに
3030
3131``` pascal
3232 procedure TForm1.Button2Click(Sender: TObject);
3333 begin
3434 {ここで次のように入力:} Close;
3535 {エディタは、このプロシージャ名を補完しました。}
3636 end;
3737```
3838
3939こう書いて、もう一度F12を押してForm1ウィンドウに戻ります。 これで、コンパイルを試みる段階まで来ました。コンパイルはとても簡単です。メインメニューにある'実行'を選択するだけです。 サブメニューで'実行'のオプションを選ぶこともできます。 また、単純にF9を押しても行えます。最初のコンパイルが行われ(うまくいけば)、リンクが完了し、コンパイルされたプログラムが実行されます。
4040
4141複数のテキストウィンドウが現れてすべてのコンパイラメッセージが表示され、その後はForm1ウィンドウが現れますが、グリッドの点は表示されません。これはあなたのアプリケーションのメインウィンドウであり、あなたがボタンを押すか他の方法で操作をするのを待っています。
4242
4343では'Press'と書かれたボタンを押してみましょう。あなたはそれが'Press again'と変わることに気づくでしょう。あなたがそれをもう一度押してもそれは'Press again'でしょう!!
4444
4545'Exit'のボタンも押してみます。ウィンドウが閉じてプログラムが終了します。オリジナルのForm1ウィンドウがドットによるグリッドとともに表示され、編集可能な状態になります。
4646
4747それではこれまでの作業を保存しておきましょう(これは頻繁に行いましょうね!!)。プロジェクトメニュー \> 別名で保存 \> your_selected_file_name.pas(適当な名前を付けます)とすれば完了です。これで、プログラムを終了して、PCの電源を切っても、保存したところから作業を再開できます。
4848
4949### プログラムを変更する
5050
5151先ほど保存しておいた、プロジェクトを開いてください。 Form1ウィンドウにある'Press'ボタンをクリックして、選択してください。 オブジェクトインスペクタのイベントタブを選択して、OnClickボックスの右側をクリックして、ソースエディタの適切な位置に戻りましょう。
5252
5353次に続くコードを参考に、さきほどのコードを書き直してみてください。
5454
5555``` pascal
5656 procedure TForm1.Button1Click(Sender: TObject);
5757 {TButtonのTagプロパティを使います。ここでは0か1の値を設定しています。}
5858 begin
5959 if Button1.tag =0 then
6060 begin
6161 Button1.caption := 'Press again';
6262 Button1.tag := 1
6363 end else
6464 begin
6565 Button1.caption := 'Press';
6666 Button1.tag := 0
6767 end
6868 end;
6969```
7070
7171保存し、もう一度コンパイルして実行しましょう。このコードによって、左側のボタンを押すと、今度はふたつのメッセージを交互に表示するようになりました。
7272
7373さあ、後は自由に工夫してみてください。
7474
7575もし、このようなGUIをもつプログラムでなく、たとえばあなたが基本的なPascalプログラミングを試してみたい、とかバッチモードで動作するプログラムを書く必要がある、とかシステムプログラミングをしたいとかそういう時には、コンソールやテキストベースのPascalプログラムを書く場面があるかもしれません。
7676
7777そんな時にも、プログラムを編集、コンパイル、実行するために、Pascalの統合開発環境としてLazarusを使うことができます。 LazarusはPascalによる開発のための理想的な環境を作ります。詳しくは[[Console Mode Pascal/ja|コンソールモードPascalをご]]覧ください。
7878
7979## エディタのウインドウ
8080
8181Lazarusを起動すると、いくつかに分割されている'フローティング'ウィンドウが、あなたのデスクトップ上に現れます。
8282
8383デスクトップ右上に、**Lazarus Editor vXXXXXX - project1**(これはあなたが現在開いているプロジェクトの名前になります)とタイトルに書かれたものが表示されています。
8484
8585これがプロジェクトのメインコントロールウィンドウで、メインメニューとコンポーネントパレットを含んでいます。
8686
8787![](/wiki-images/2/2f/LazMain_ja.png)
8888
8989タイトルバー下のラインは*メインメニュー*でファイル、編集、検索、表示メニューなどを含んでおり、Lazarusの基本的な操作をおこなえます。
9090
9191この下に一組のビットボタン(よく使うメニューアイテムへのショートカットになっています)があり、その右側にはコンポートネントパレットがあります。
9292
9393Lazarus 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.
9494
9595あなたが新しいプロジェクトを始めるとき、(Lazarusもしくはあなたが最初にLazarusを起動するとき)デフォルトのフォームが既に作成されていることでしょう。ここにはドットでグリッドが描かれており、あなたがコンポーネントをフォームに配置するときの手助けをします。そしてタイトルバーには**最小化**、 **最大化** そして **閉じる**のボタンがあります。もし あなたがこのウィンドウをクリックすればデスクトップの左側にあるオブジェクトインスペクタにこのフォームのプロパティが表示されます。
9696
9797他のウィンドウが貴方の作業中に目にはいるようになることもあるでしょう。 **[プロジェクトインスペクタ](http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg)**はあなたのプロジェクトの詳細と、関連するファイルを表示し、またファイルの追加や削除を行うことができます。**メッセージウィンドウ** は貴方のプロジェクトに関するコンパイラからのメッセージやエラー、もしくは進行状態を表示します。もしもLazarusをターミナルウィンドウから起動しているなら、本来ターミナルに表示されるべきことがらや、コンパイラメッセージの詳細が出力されます。
9898
9999## メインメニュー
100100
101101Lazarus IDEのメインメニューからアクセスできるすべてのメニューアイテムの詳細な説明については、[[Main menu/ja|Main menu/jaページを]]参照してください。
102102
103103## IDE クールバー
104104
105105![](/wiki-images/d/d3/Ide_coolbar.png)
106106
107107メインコントロールウィンドウの左側、メインメニューの直下、コンポーネントパレットの左にIDEクールバーがあります。ここには、メインメニューの中でよく用いられる機能のボタンがあります:
108108
109109
110110**新規ユニット**、**開く** (ボタン右側の下向き矢印を押すと最近扱ったファイルの一覧が表示されます)、**保存**、**すべて保存**、**新規フォーム**、**フォーム/ユニット切り替え**(フォームかユニットのソースコードを表示)、**ユニットを表示**、**フォームを表示**、**実行**(コンパイルして実行)、**一時停止**、**トレース実行**、**ステップ実行**(最後の2つはデバッガの機能)
111111
112112## コンポーネントパレット
113113
114114コンポーネントパレットとは、多くのアイコンが並んだタブ付きのツールバーのことです。各アイコンは、フォームを作成する際によく用いられるコンポーネントを表しています。
115115
116116![](Component_Palette_Standard.png "size="100%")
117117
118118それぞれのタブは機能ごとに分けられており、異なった組のアイコンからなります。 全てのタブでは、一番左に矢印のアイコンがあります。これは選択ツール(Selection Tool)と呼びます。
119119
120120マウスカーソルをコンポーネントパレットのアイコンの上に移動して、しばらくクリックしないで待つと、アイコンが意味するコンポーネントの名前がポップアップします。 それらの名前がすべて 'T' で始まることに注意してください。これは、そのコンポーネントの 「型:'Type'」 、正確に言うとコンポーネントの 「クラス:'Class'」 を示しています。
121121
122122コンポーネントをフォームに加えると、その [[Class]] が [[Unit]] の **[[Interface]]** 部の **[[Type]]** セクションに追加されます。(通常は TForm1 の定義の一部として) 同時に、そのクラスの **instance** が **[[Var]]** セクションに加えられます(通常、Form1という名前の変数として)。 フォームやコンポーネントが用いる **Methods** は、全て(つまり全ての [[Procedure]] と [[Function]] )、そのユニットの **[[Implementation]]** 部で宣言する必要があります。
123123
124124#### コンポーネントのサンプルプログラム
125125
126126コンポーネントのサンプルプログラムは、 \$LazarusPath/lazarus/examples に保存されています。
127127
128128多くのプログラムで、IDEやコンポーネントパレットを使わないでダイアログや他のコンポーネントを利用する方法が分かるでしょう。全てのコンポーネントは、明確に主となるpascalプログラムで定義されています。 IDEを大いに利用するサンプルもあります。
129129
130130サンプルプログラムの中には、そのままでは動作しないものもあるでしょう。ファイルやディレクトリのパス、パーミッションを設定する必要があるかも知れません。サンプルプログラムをコンパイルするにあたり、ファイル及びディレクトリに対する 読み/書き/実行 (read/write/execute) のパーミッションを確認して下さい。または適切なパーミッションを持ったディレクトリにファイルをコピーしてください。
131131
132132まずは、'testall' プログラムを実行してみましょう。利用可能なコンポーネントのメニューと簡単な実行例があります。コードを読んでどう動いているか調べてみましょう!
133133
134134#### コンポーネントの一覧
135135
136136コンポーネントの一覧を以下に示します。各ユニットには、それらの解説するページへのリンクが張ってあります(ないのもあります)。 あるコンポーネントのプロパティについて知りたければ、そのコンポーネントの継承を調べ、継承元となるコンポーネントについて調べるとよいでしょう。 例えば、TMaskEdit について理解することは、 TCustomMaskEditについて調査する際にも役に立ちます。
137137
138138**タブの名前** (タブ自体の名前がおよその説明になっています。)
139139
140140- **[Standard](http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/index-4.html)**(基本:コンポーネントの記述は、[[Standard tab/ja|Standard タブ]] にあります)。
141141
142142![](/wiki-images/4/4d/Component_Palette_Standart.png)
143143
144144
145145[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)
146146
147147- **[Additional](http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/index-4.html)** (追加:コンポーネントの自体は、[[Additional tab/ja|Additionalタブ]] もご覧下さい。)
148148
149149![](/wiki-images/7/7d/Component_Palette_Additional.png)
150150
151151
152152[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)
153153
154154- **[Common Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/index-4.html)** (コンポーネントの記述は、 [[Common Controls tab]] にあります。)
155155
156156![](/wiki-images/4/4a/Component_Palette_Common_Controls.png)
157157
158158
159159[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)
160160
161161- **[Dialogs](http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/index-4.html)** (コンポーネントの記述は、 [[Dialogs tab]] にあります。)
162162
163163![](/wiki-images/7/72/Component_Palette_Dialogs.png)
164164
165165
166166[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)
167167
168168パレットに含まれていませんが、他にもいくつかの便利な **[ダイアログ](http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples)**手続きや関数があります。それらはソースプログラムから直接に呼び出せ、簡単に利用できます。
169169
170170- **Misc**(その他)
171171
172172![](/wiki-images/8/8e/Component_Palette_Misc.png)
173173
174174
175175[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
176176
177177- **[Data Controls](http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/index-4.html)**(データの制御。Standard及びAdditionalグループに似ていますが、データベースに適用できます)
178178
179179![](/wiki-images/6/62/Component_Palette_DataControls.png)
180180
181181
182182[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)
183183
184184- **Data Access**(データへのアクセス)
185185
186186![](/wiki-images/c/cc/Component_Palette_DataAccess.png)
187187
188188
189189TDatasource, TMemDataset, TSdfDataSet, TFixedFormatDataSet, TDbf
190190
191191- **System**(システム)
192192
193193![](/wiki-images/f/fe/Component_Palette_System.png)
194194
195195
196196[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
197197
198198- **SynEdit**(SynEdit:他の言語や開発ツールへのインターフェースとなるコンポーネント[sourceforge](http://synedit.sourceforge.net/))
199199
200200![](/wiki-images/2/22/Component_Palette_SynEdit.png)
201201
202202
203203TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynFreePascalSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynVBSyn, TSynAnySyn, TSynMultiSyn
204204
205205SynEditは、 Borland Delphi, Kylix と C++Builder用の複数行編集コントロールであり、文法ハイライト機能やコード補完機能、HTMLやTeX、RTFへのエクスポート機能を持っています。これは完全なVCL/CLXコントロールであり、Microsoft Windows のコントロールのラッパーではなく、ランタイムライブラリを必要としない、クロスプラットフォームで利用できるコンポーネントです。FreePascalとの互換性も計画されており、 Lararus IDE をエディタも SynEditが利用されています。[sourceforge](http://synedit.sourceforge.net/)も参照ください。
206206
207207#### コンポーネントパレットの使い方
208208
209209コンポーネントパレットの利用にあたっては、フォームが作成されており、エディタ上で見えている必要があります(フォームが無い場合は、 File -\> New Form で新たなフォームが作成してください)。 次に、使いたいコンポーネントのアイコンをクリックして選択し、フォーム上のコンポーネントを配置したい位置でクリックすることで、選択されたコンポーネントが配置されます。 コンポーネントの移動やサイズの調整は、マウスで直接操作することでもできますし、コンポーネントのプロパティの値をオブジェクトエディタから直接操作することでもできます。
210210
211211コンポーネントを新たに追加したときには(自作や他のパッケージから追加するなど)、コンポーネントパレットに新しいタブが現れ、コンポーネントに応じたアイコンが表示されます。それらは他のコンポーネントと同様に使用できます。
212212
213213## デバッガ
214214
215215
216216(まだ書かれていません)
217217
218218## Lazarusのファイルについて
219219
220220ファイルの保存操作をすると、次の二つのファイルを保存することになります:
221221
222-`  xxx.pas`\
223-`  yyy.lpr `
222+```text
223+ xxx.pas
224+ yyy.lpr
225+```
224226
225227他にも保存されるファイルはありますが、あなたが名前をつけられるのはこの二つです。 プロジェクトファイル (lpr) 及びユニットファイル (pas) は同じ名前であってはいけません。Lazarus はユニットの名前(ソースコードに現れる名前)をユニットファイル名(xxxの部分)と同じになるように、またプログラムの名前をプロジェクトファイル名(yyyの部分)と同じになるように設定するので、同じになっていると、プロジェクト中で識別子が重複してしまいます。 一貫性を維持するため、project1 や、unit1 に適当な名前をつけましょう。
226228
227229たとえば、**again** という名前のプロジェクトを保存しようとする際に、again.pas と again.lpr という名前で保存しようとするとうまくいきません。ユニット名とプログラム名は同じプロジェクト中にあるため、名前が重複したというエラー duplicate name error になります。
228230
229231そこで、次のようになりました:
230232
231233e:/lazarus/kj/lazhello:
232234
233-`total 4740  free 76500`\
234-`-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe`\
235-`-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi`\
236-`-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr`\
237-`-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm`\
238-`-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs`\
239-`-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas`\
240-`-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu`\
241-`-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat`
235+```text
236+total 4740 free 76500
237+-rwxrwxrwx 1 kjwh root 4618697 Mar 24 11:19 again.exe
238+-rw-rw-rw- 1 kjwh root 3002 Mar 24 11:21 again.lpi
239+-rw-rw-rw- 1 kjwh root 190 Mar 24 11:18 again.lpr
240+-rw-rw-rw- 1 kjwh root 506 Mar 24 11:08 againu.lfm
241+-rw-rw-rw- 1 kjwh root 679 Mar 24 11:08 againu.lrs
242+-rw-rw-rw- 1 kjwh root 677 Mar 24 11:08 againu.pas
243+-rw-rw-rw- 1 kjwh root 2124 Mar 24 11:08 againu.ppu
244+-rwxrwxrwx 1 kjwh root 335 Mar 24 11:07 ppas.bat
245+```
242246
243247二つのファイル (again.lpr、againu.pas) を保存したと思っていたのに、もっと多くのファイルが保存されています。
244248
245249それぞれのファイルの簡単な説明をしておきましょう:
246250
247251**again.exe:**
248252メインプログラムのバイナリ実行ファイルです。Win32では拡張子"exe"がつきます。Linux(やMac OS X)では何もつきません。デバッグ用のシンボルを含むために、Linuxでは巨大なファイルになります。"strip"コマンドでそれらを除去すると実行ファイルを小さくすることができます。
249253
250254**again.lpi:**
251255Lazarus プロジェクトのメインファイルです (Lazarus Project Information); Delphi でこれと同等なものが .dpr です。このファイルは XML フォーマットで保存されます。
252256
253257**again.lpr:**
254258メインプログラムのソースファイルです。Lazarus特有の拡張部分を除くと、実際にはごく普通の Pascal ソースファイルです。
255259
256260uses節があり、コンパイラはその記述に従って必要な全ユニットを見つけます。Program 宣言の名前はファイル名と一致する必要があります。
257261
258262**againu.lfm:**
259263フォームユニットのレイアウトを格納します。Lazarus はこれを用いてリソースファイルを生成し、それが againu.pas の初期化セクション でインクルードされます。 Lazarus IDE の Tools-\>Convert DFM file to LFM utility を用いると、Delphi の dfm ファイルをlfmに変換することができます。
260264
261265**againu.lrs:**
262266生成されたリソースファイルです。Windows のリソースファイルとは異なります。
263267
264268**againu.pas:**
265269このユニットにフォームのコードを書きます。
266270
267271**againu.ppu:**
268272ユニットをコンパイルしたオブジェクトコードです。
269273
270274**ppas.bat:**
271275プログラムをリンクし実行ファイルを作るための簡単なスクリプト(バッチファイル)です。コンパイルが成功すれば、コンパイラによって削除されます。
272276
273277## Original contributors and changes
274278
275279This page has been imported from the epikwiki [version](http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusTutorial).
276280
277281- Created initial page and template. T. Lisjac - 11/04/2003 VlxAdmin
278282- 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
279283- Per above, moved Chris's writeup to the main body of the tutorial VlxAdmin
280284- Began to insert text describing the Lazarus Editor - more to follow! 24 Mar 2004 User:Kirkpatc
281285- Added some more to Lazarus Editor section of Tutorial. 25 Mar 2004 User:Kirkpatc
282286- Added screenshots and revised some of the page formatting VlxAdmin 3/25/2004
283287- 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
284288- Formatted, added credits and comments. Removed original notes. VlxAdmin 3/26/2004
285289- More material added to Editor section of tutorial. 26 Mar 2004 User:Kirkpatc
286290- 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
287291- Inserted section on Run sub-menu. Some general editing (eg ended each entry with a period to ensure consistency). 9 Apr 2004 User:Kirkpatc
288292- Inserted a new section on How to get started with MySQL in FPC/Lazarus. 13 Apr 2004 User:Kirkpatc
289293- Deleted the section on MySQL from here: it has been copied to Lazarus Database section of tutorial. 14 Apr 2004 User:Kirkpatc
290294- Added some more to the description of the Editor Main Menu. 18 Apr 2004 User:Kirkpatc
291295- Added section on Environment sub-menu. 19 Apr 2004 User:Kirkpatc
292296- Added section on Components sub-menu. 4 May 2004 User:Kirkpatc
293297- Adding Tools sub-menu description (incomplete). 7 May 2004 User:Kirkpatc
294298- Added some screenshots to Menu descriptions. 9 May 2004 User:Kirkpatc
295299- Fixed a bit in Environment Options - thanks VincentSnijders. 14 May 2004 User:Kirkpatc
296300- More additions to Tools sub-menu. 19 May 2004 User:Kirkpatc
297301- Added a section on the Button Bar and started work on The Component Palette. 20 May 2004 User:Kirkpatc
298302- Posted a description file for the StdCtrls unit of the LCL, in the hope that people will add comments. 26 May 2004 User:Kirkpatc
299303- 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
300304- Expanding on the Components Palette. 5 June 2004 User:Kirkpatc
301305- Added a lot to the DialogExamples page. 10 June 2004 User:Kirkpatc
302306- 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
303307- 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
304308- Added page for Common Controls (linked to Component Palette). 16 June 2004 User:Kirkpatc
305309- Added MaskEdit page (linked to Component Palette). 17 June 2004 User:Kirkpatc
306310- Added Buttons, ExtCtrls pages (linked to Component Palette). 17 June 2004 User:Kirkpatc
307311- Edited MainMenu component description page. 23 June 2004 User:Kirkpatc
308312- Some additions to Common Controls. 28 June 2004 User:Kirkpatc
309313- A new tutorial on Text-mode Pascal programming has been added. 5 July 2004 User:Kirkpatc
310314- Minor changes to ComCtrls, ExtCtrls, Environment Menu. 10 July User:Kirkpatc
311315- Added FormsTxt, component description page for Component Palette. 20 July 2004 User:Kirkpatc
312316- Some corrections to ConsoleModePascal. 21 July 2004 User:Kirkpatc
313317- Some small changes to ComponentPalette. 22 July 2004 User:Kirkpatc
314318- Some edits and additions to the Lazarus Component section. 23th Jan 2009 User: Miyatake
315319
316320---
317321*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