Difference between revisions of "Lazarus Tutorial/ja"

From Free Pascal wiki
Jump to navigationJump to search
 
(103 intermediate revisions by 5 users not shown)
Line 6: Line 6:
  
 
== 概要 ==
 
== 概要 ==
Lazarusはフリーでオープンソースの開発ツールです。これは、フリーでオープンソースのFreePascalコンパイラ(object pascal)を利用しています。Lazarus IDE([http://lazarus-ccr.sourceforge.net/kbdata/lazide.jpg スクリーンショット]) はとても安定し、他への依存度がほとんどありません。Lazarusを使って機能豊富なグラフィカルアプリケーション、コンソールアプリケーションの開発ができます。
+
Lazarusは Free Pascal コンパイラのためのフリーでオープンソースな開発ツールです。 Lazarus IDEは、機能が豊富なプログラム環境であり、単独で機能するGUIアプリケーションやコンソールアプリケーションを開発できます。 Lazarusは、現在 Linux、 FreeBSD、 Win32 そして Mac OS X の上で動作し、カスタマイズ可能なソースエディタ、FreePascalコンパイラと統合された完全なGUI、
Lazarusは現在Linux、FreeBSD、Win32そしてOS Xの上で動作し、カスタマイズ可能なソースエディタ、ビジュアルなフォーム作成機能、パッケージマネージャ、デバッガといったものが、GUIによって備えられてFreePascalと完璧に統合しています。
+
パッケージマネージャやデバッガを持つビジュアルなフォーム作成環境を提供します。
  
 +
[[Image:Laz ScreenShot ja.png|スクリーンショット]]
  
== 始めましょう - 最初のLazarusによるプログラムを! ==
+
== Lazarusでプログラムをはじめてみよう ==
  
([[User:Kirkpatc]]、ありがとう)
+
[[Installing Lazarus/ja|Lazarusをインストール]]して、起動してみてください。これだけで、Free PascalやLazarusをつかったプログラムをはじめてみることができます。
  
まず、[[Installing Lazarus/ja|Lazarusをインストール]]して、起動しましょう。これだけで、Free Pascalでのプログラムの生成が可能です。
+
起動すると、いくつかのウィンドウがデスクトップ上に現れます。上の方にはメインメニューがあります。左には、'''[[IDE_Window:_Object_Inspector/ja|オブジェクトインスペクタ]]'''あります。そのほかのデスクトップの大部分は、'''[[source_code_editor/ja|ソースコードエディタ]]'''です。多分Form1ウィンドウが作られていて、ソースエディタに重なっているはずです。
  
いくつかのウィンドウがデスクトップ上に現れます。メインメニューが上の方に、オブジェクトインスペクタが左に、Lazarusソースエディタがデスクトップの大部分を占有しています。そして、おそらくForm1ウィンドウが作られ、ソースエディタの上にかぶさっているはずです。
+
上の方にあるメニューウィンドウの、メニューの下にタブの列があります。'標準'タブが選択されていますね。そこでButtonアイコン(四角の中に「OK」と書いてあるもの)を探してクリックしてください。そして、Form1の上の左中央あたりでクリックしてください。すると'Button1'と書かれた四角い図形(=ボタンです)が現れるはずです。もう一回標準タブのButtonアイコンをクリックして、Form1の右中央でクリックしてください。'Button2'と書かれたボタンが現れます。
 
 
上の方にあるメニューウィンドウの、メニューの下にタブの列があります。'標準'タブが選択されていますね。そこでButtonアイコン(四角の中に「OK」と書いてあるもの)を探してクリックしてください。そして、Form1の上の左中央あたりでクリックしてください。すると'Button1'と書かれた四角が現れるはずです。もう一回標準タブのButtonアイコンをクリックして、Form1の右中央でクリックしてください。'Button2'と書かれた四角が現れます。
 
 
 
Button1をクリックしましょう。オブジェクトインスペクタに、オブジェクトButton1のプロパティが表示されます。'Caption'と名付けられたプロパティに'Button1'と表示されていますね。そのボックスをクリックして'Button1'を'Press'に書き換えてください。あなたがENTERキーを押すか、別のボックスをクリックすれば、最初にForm1に置いたボタンが'Press'という名前になります。続いて、オブジェクトインスペクタ上のイベントタブをクリックすると、さまざまなイベントを見ることができ、それらをボタンによって関連付けすることができます。OnClick、OnEnter、OnExitなどがあります。OnClickボックスの右側を選択してください。小さなボックスが...と一緒に表示されます。あなたがこれをクリックすれば、自動的にソースエディタに移動してカーソルはコードの開始部分に合わせられます。
 
  
 +
Button1をクリックしましょう。オブジェクトインスペクタに、オブジェクトButton1のプロパティが表示されます。'Caption'と名付けられたプロパティに'Button1'と表示されていますね。その部分をクリックして'Button1'を'Press'に書き換えてください。あなたがENTERキーを押すか、別のボックスをクリックすれば、最初にForm1に置いたボタンが'Press'という名前になります。
 +
続いて、オブジェクトインスペクタ上のイベントタブをクリックすると、ボタンに関連付けられている色々なイベントを見ることができます。
 +
イベントには、たとえば、OnClick、OnEnter、OnExitなどがあります。OnClickボックスの右側を選択してください。小さなボックスが...と一緒に表示されます。あなたがこれをクリックすれば、自動的にソースエディタに移動してカーソルはコードの開始部分に移動します。
 +
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   begin
 
   begin
Line 27: Line 28:
 
     {エディタは、このプロシージャ名を補完しました。}
 
     {エディタは、このプロシージャ名を補完しました。}
 
   end;
 
   end;
 
+
</syntaxhighlight>
 
と入力したら、F12を押してソースエディタから出てForm1ウィンドウを選択してください。
 
と入力したら、F12を押してソースエディタから出てForm1ウィンドウを選択してください。
  
 
続いてButton2のプロパティを編集します。Button2をクリックして、プロパティをオブジェクトインスペクタに表示させてください。Captionプロパティを変更して'Button2'から'Exit'にします。イベントタブを選択して、OnClickボックスをクリックしてください。...をクリックして、ソースエディタに入り、真ん中あたりのプロシージャに
 
続いてButton2のプロパティを編集します。Button2をクリックして、プロパティをオブジェクトインスペクタに表示させてください。Captionプロパティを変更して'Button2'から'Exit'にします。イベントタブを選択して、OnClickボックスをクリックしてください。...をクリックして、ソースエディタに入り、真ん中あたりのプロシージャに
 
+
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   procedure TForm1.Button2Click(Sender: TObject);
 
   begin
 
   begin
Line 37: Line 38:
 
     {エディタは、このプロシージャ名を補完しました。}
 
     {エディタは、このプロシージャ名を補完しました。}
 
   end;
 
   end;
 +
</syntaxhighlight>
 +
こう書いて、もう一度F12を押してForm1ウィンドウに戻ります。
 +
これで、コンパイルを試みる段階まで来ました。コンパイルはとても簡単です。メインメニューにある'実行'を選択するだけです。
 +
サブメニューで'実行'のオプションを選ぶこともできます。
 +
また、単純にF9を押しても行えます。最初のコンパイルが行われ(うまくいけば)、リンクが完了し、コンパイルされたプログラムが実行されます。
  
と書いて、もう一度F12を押してForm1ウィンドウに戻ります。あなたはコンパイルを試みる段階まで来ました。この行為は非常に簡単でメインメニューにある'実行'を選択するだけです。サブメニューで'実行'のオプションを選ぶこともできます。単純にF9を押して行うことも可能です。最初のコンパイルが行われ(うまくいけば)、リンクが完了し、続いてあなたのプログラムが実行されます。
+
複数のテキストウィンドウが現れてすべてのコンパイラメッセージが表示され、その後はForm1ウィンドウが現れますが、グリッドの点は表示されません。これはあなたのアプリケーションのメインウィンドウであり、あなたがボタンを押すか他の方法で操作をするのを待っています。
 
 
複数のテキストウィンドウが現れてすべてのコンパイラメッセージが表示され、その後はForm1ウィンドウが現れますが、グリッドの点は表示されません。これはあなたのアプリケーションのメインウィンドウであり、あなたがボタンを押すか他の方法で割り込んでくるのを待っています。
 
  
 
では'Press'と書かれたボタンを押してみましょう。あなたはそれが'Press again'と変わることに気づくでしょう。あなたがそれをもう一度押してもそれは'Press again'でしょう!!
 
では'Press'と書かれたボタンを押してみましょう。あなたはそれが'Press again'と変わることに気づくでしょう。あなたがそれをもう一度押してもそれは'Press again'でしょう!!
Line 46: Line 50:
 
'Exit'のボタンも押してみます。ウィンドウが閉じてプログラムが終了します。オリジナルのForm1ウィンドウがドットによるグリッドとともに表示され、編集可能な状態になります。
 
'Exit'のボタンも押してみます。ウィンドウが閉じてプログラムが終了します。オリジナルのForm1ウィンドウがドットによるグリッドとともに表示され、編集可能な状態になります。
  
それではあなたの仕事を保存しておきましょう(これは頻繁に行いましょうね!!)。プロジェクトメニュー > 別名で保存 > your_selected_file_name.pas(適当な名前を付けます)としてやれば完了です。
+
それではこれまでの作業を保存しておきましょう(これは頻繁に行いましょうね!!)。プロジェクトメニュー > 別名で保存 > your_selected_file_name.pas(適当な名前を付けます)とすれば完了です。これで、プログラムを終了して、PCの電源を切っても、保存したところから作業を再開できます。
  
=== 第2段階 ===
+
=== プログラムを変更する ===
保存しておいた、あなたのプロジェクトを開いてください。
+
先ほど保存しておいた、プロジェクトを開いてください。
 
Form1ウィンドウにある'Press'ボタンをクリックして、選択してください。
 
Form1ウィンドウにある'Press'ボタンをクリックして、選択してください。
 
オブジェクトインスペクタのイベントタブを選択して、OnClickボックスの右側をクリックして、ソースエディタの適切な位置に戻りましょう。
 
オブジェクトインスペクタのイベントタブを選択して、OnClickボックスの右側をクリックして、ソースエディタの適切な位置に戻りましょう。
  
次に続くコードを読んで、あなたのコードを書き直してください。
+
次に続くコードを参考に、さきほどのコードを書き直してみてください。
 
+
<syntaxhighlight lang=pascal>
 
   procedure TForm1.Button1Click(Sender: TObject);
 
   procedure TForm1.Button1Click(Sender: TObject);
  {Tagプロパティを使います。ここでは0か1の値をとります。}
+
  {TButtonのTagプロパティを使います。ここでは0か1の値を設定しています。}
 
   begin
 
   begin
 
     if Button1.tag =0 then
 
     if Button1.tag =0 then
Line 68: Line 72:
 
     end
 
     end
 
   end;
 
   end;
 +
</syntaxhighlight>
 +
保存し、もう一度コンパイルして実行しましょう。このコードによって、左側のボタンを押すと、今度はふたつのメッセージを交互に表示するようになりました。
 +
 +
さあ、後は自由に工夫してみてください。
 +
 +
もし、このようなGUIをもつプログラムでなく、たとえばあなたが基本的なPascalプログラミングを試してみたい、とかバッチモードで動作するプログラムを書く必要がある、とかシステムプログラミングをしたいとかそういう時には、コンソールやテキストベースのPascalプログラムを書く場面があるかもしれません。
  
あなたの作業を保存したならば、もう一度コンパイルして実行しましょう。左側のボタンを押すと、それはふたつのメッセージを交互に表示するようになっているはずです。
+
そんな時にも、プログラムを編集、コンパイル、実行するために、Pascalの統合開発環境としてLazarusを使うことができます。
 +
LazarusはPascalによる開発のための理想的な環境を作ります。詳しくは[[Console Mode Pascal/ja|コンソールモードPascal]]をご覧ください。
  
さあ、後は自分でがんばってみましょう。
+
== エディタのウインドウ ==
 +
Lazarusを起動すると、いくつかに分割されている'フローティング'ウィンドウが、あなたのデスクトップ上に現れます。
  
あなたがコンソールやテキストベースのPascalプログラムを書きたければ(たとえばあなたが基本的なPascalプログラミングの道を歩みたい、とかバッチモードで動作するプログラムを書く必要がある、とかシステムプログラミングをしたいとかそういう時)、あなたは自分のプログラムを編集したりコンパイルしたり実行するために尚Lazarusを使うことができます。LazarusはPascalによる開発のための理想的な環境を作ります。詳しくは[[Console Mode Pascal/ja|コンソールモードPascal]]をご覧ください。
+
デスクトップ右上に、'''Lazarus Editor vXXXXXX - project1'''(これはあなたが現在開いているプロジェクトの名前になります)とタイトルに書かれたものが表示されています。
  
== エディタ ==
+
これがプロジェクトのメインコントロールウィンドウで、メインメニューとコンポーネントパレットを含んでいます。
最初にあなたがLazarusを起動すると、分割され結合が解除されているものか、'フローティング'ウィンドウが、あなたのデスクトップ上に現れるでしょう。
 
  
まずはじめに、'''Lazarus Editor vXXXXXX - project1'''(これはあなたが現在開いているプロジェクトの名前になります)とタイトルに書かれたものがデスクトップの右上方に現れるでしょう。
 
これはあなたのプロジェクトのメインコントロールウィンドウで、メインメニューとコンポーネントパレットを含んでいます。
 
  
<center>[[Image:Lazmain.jpg]]</center>
+
<center>[[Image:LazMain ja.png]]</center>
  
タイトルバー下のラインは''メインメニュー''でファイル、編集、検索、表示メニューなどを含んでおり。いくつかはLazarusの基本情報でもあります。
 
  
この下に一組のビットボタン(特定のメニューアイテムへのショートカットになっています)があり、その右側にはコンポートネントパレットがあります。
+
タイトルバー下のラインは''メインメニュー''でファイル、編集、検索、表示メニューなどを含んでおり、Lazarusの基本的な操作をおこなえます。
  
Lazarus Editorウィンドウの下には'''[http://lazarus-ccr.sourceforge.net/kbdata/objinsp.jpg オブジェクトインスペクタ]'''が左側に、 '''[http://lazarus-ccr.sourceforge.net/kbdata/editor.jpg Lazarusソースエディタ]'''が右側にあります。他に小さな窓があり、'''[http://lazarus-ccr.sourceforge.net/kbdata/blankform.jpg Form1]'''と名付けられていてLazarusソースエディタウィンドウの上に覆いかぶさっているでしょう。これが見えなければ'''F12'''キーを押すことですぐに画面上に復帰させることができます。 Formウィンドウはあなたのアプリケーションのグラフィカルインターフェイスを作成するためにあり、ソースエディタはあなたのアプリケーションのPascalコードを表示します。The operation of the Object Inspector is discussed in more detail below while the Component Palette is described.
+
この下に一組のビットボタン(よく使うメニューアイテムへのショートカットになっています)があり、その右側にはコンポートネントパレットがあります。
 +
 
 +
Lazarus Editorウィンドウの下には'''[[IDE_Window:_Object_Inspector/ja|オブジェクトインスペクタ]]'''が左側に、 '''[[source_code_editor/ja|ソースコードエディタ]]'''が右側にあります。他に小さな窓があり、'''[http://lazarus-ccr.sourceforge.net/kbdata/blankform.jpg Form1]'''と名付けられていてLazarusソースエディタウィンドウの上に覆いかぶさっているでしょう。これが見えなければ'''F12'''キーを押すことですぐに画面上に復帰させることができます。 Formウィンドウはあなたのアプリケーションのグラフィカルインターフェイスを作成するためにあり、ソースエディタはあなたのアプリケーションのPascalコードを表示します。The operation of the Object Inspector is discussed in more detail below while the Component Palette is described.
  
 
あなたが新しいプロジェクトを始めるとき、(Lazarusもしくはあなたが最初にLazarusを起動するとき)デフォルトのフォームが既に作成されていることでしょう。ここにはドットでグリッドが描かれており、あなたがコンポーネントをフォームに配置するときの手助けをします。そしてタイトルバーには'''最小化'''、 '''最大化''' そして '''閉じる'''のボタンがあります。もし あなたがこのウィンドウをクリックすればデスクトップの左側にあるオブジェクトインスペクタにこのフォームのプロパティが表示されます。
 
あなたが新しいプロジェクトを始めるとき、(Lazarusもしくはあなたが最初にLazarusを起動するとき)デフォルトのフォームが既に作成されていることでしょう。ここにはドットでグリッドが描かれており、あなたがコンポーネントをフォームに配置するときの手助けをします。そしてタイトルバーには'''最小化'''、 '''最大化''' そして '''閉じる'''のボタンがあります。もし あなたがこのウィンドウをクリックすればデスクトップの左側にあるオブジェクトインスペクタにこのフォームのプロパティが表示されます。
Line 94: Line 104:
 
'''[http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg プロジェクトインスペクタ]'''はあなたのプロジェクトの詳細と、関連するファイルを表示し、またファイルの追加や削除を行うことができます。'''メッセージウィンドウ''' は貴方のプロジェクトに関するコンパイラからのメッセージやエラー、もしくは進行状態を表示します。もしもLazarusをターミナルウィンドウから起動しているなら、本来ターミナルに表示されるべきことがらや、コンパイラメッセージの詳細が出力されます。
 
'''[http://lazarus-ccr.sourceforge.net/kbdata/projinsp.jpg プロジェクトインスペクタ]'''はあなたのプロジェクトの詳細と、関連するファイルを表示し、またファイルの追加や削除を行うことができます。'''メッセージウィンドウ''' は貴方のプロジェクトに関するコンパイラからのメッセージやエラー、もしくは進行状態を表示します。もしもLazarusをターミナルウィンドウから起動しているなら、本来ターミナルに表示されるべきことがらや、コンパイラメッセージの詳細が出力されます。
  
 +
== メインメニュー ==
  
=== メインメニュー ===
+
Lazarus IDEのメインメニューからアクセスできるすべてのメニューアイテムの詳細な説明については、[[Main menu/ja]]ページを参照してください。
  
メインメニューバーには、
+
== IDE クールバー ==
ファイル(<u>F</u>)、編集(<u>E</u>)、検索(<u>S</u>)、表示(<u>V</u>)、プロジェクト(<u>P</u>)、実行(<u>R</u>)、コンポーネント(<u>C</u>)、ツール(<u>T</u>)、環境(<u>n</u>)、ウィンドウ(<u>W</u>)、そしてヘルプ(<u>H</u>)という項目があります。
 
  
通常とおなじように、オプションを選択するにはマウスカーソルをそのメニュー項目の上に置いてクリックするか、キーボードのAlt-Fを押します(主メニューウィンドウにフォーカスが当たっていることを前提にしています。そうなっていなければ、TABを何回か押してください。押す毎にフォーカスが様々なウィンドウの上をサイクリックに移ります。望むウィンドウのタイトルバーが色付きではっきり見えるようになるまでTABを押します)。
+
[[file:ide_coolbar.png]]
  
==== '''ファイル'''メニュー ====
+
メインコントロールウィンドウの左側、メインメニューの直下、コンポーネントパレットの左にIDEクールバーがあります。ここには、メインメニューの中でよく用いられる機能のボタンがあります:
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/FileMenuSnapshot.png </div>
+
: '''新規ユニット''''''開く''' (ボタン右側の下向き矢印を押すと最近扱ったファイルの一覧が表示されます)、'''保存''''''すべて保存''''''新規フォーム''''''フォーム/ユニット切り替え'''(フォームかユニットのソースコードを表示)、'''ユニットを表示''''''フォームを表示''''''実行'''(コンパイルして実行)、'''一時停止''''''トレース実行''''''ステップ実行'''(最後の2つはデバッガの機能)
* '''新規ユニット''': 新しいユニットファイルを作ります(Pascalソースコード)。
 
* '''新規フォーム''': 新しいフォームを作ります。視覚的なウィンドウとそれに準じたPascalソースコードの両方を生成します。
 
* '''新規 ...''': 表示されたメニューボックス内 ([http://lazarus-ccr.sourceforge.net/kbdata/menu-new.jpg screenshot]) に作成するドキュメントファイルの種類が表示されます。
 
* '''開く ...''': ダイアログボックス内にファイルシステムが表示され、ファイルを選択して開きます。
 
* '''戻す''': ファイルの編集や変更を元の状態に戻します。
 
* '''最近使ったファイル''': 最近編集したファイルのリストが表示され、ファイルを選択して開きます。
 
* '''保存''': 開いているファイルを保存します。名前は元の名前を使います。名前がないときはシステムがプロンプトを表示します(名前を付けて保存、と同じ状態になります)。
 
* '''名前を付けて保存''': 開いているファイルの保存先のディレクトリと名前を指定して保存します。
 
* '''閉じる''': 開いているファイルを閉じます。全ての変更を保存するかどうかプロンプトが表示されます。prompting wheter to save all editor changes.
 
* '''全て閉じる''': 現在エディタで開かれている全てのファイルを閉じます。変更を保存するかどうかプロンプトが表示されます。
 
* '''ディレクトリの掃除''' '''Clean directory''': カレントディレクトリからファイルを取り除きます。取り除くファイルを決定するフィルタは編集することができます。.bak ファイルや古い Delphi のプロジェクトの遺残物を取り除くのに便利です。Offers a dialog with a series of editable filters for removing files from the current directory.  Useful for removing .bak files and remnants of former Delphi projects.
 
* '''終了''': Lazarusを終了します。全ての変更されたファイルを保存するかどうかプロンプトが表示されます。
 
<div style="clear:both;"></div>
 
  
==== '''編集'''メニュー  The Edit sub-menu ====
+
== コンポーネントパレット ==
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/EditMenuSnapshot.png </div>
+
コンポーネントパレットとは、多くのアイコンが並んだタブ付きのツールバーのことです。各アイコンは、フォームを作成する際によく用いられるコンポーネントを表しています。
* '''元に戻す''': 最後に編集した部分を元に戻します。 leaving the Editor in the state just before the last action.
 
* '''やり直す''': "元に戻す"によって変更された箇所を変更前(つまり編集後のもの)に戻します。
 
* '''切り取り''': 選択されたテキストやアイテムとその場所を削除して、クリップボードに転送します。
 
* '''コピー''': 選択されたテキストをコピーします。コピー元は元の位置のままに、コピーしたものはクリップボードに転送します。
 
* '''貼り付け''': クリップボードにあるコンテンツをカーソルのポジションに貼り付けます。もしテキストで、カーソルによって選択された部分が存在する場合、そこと置き換えます。
 
* '''Indent selection''': 選択されたテキストをEnvironment -> Editor options -> General -> Block indentの設定に従い右に移動します。Pascalソースコードに含まれるブロック構造を目に見えるようにするのに便利です。This feature is useful for formatting your Pascal source code to show the underlying Block structure.
 
* '''Unindent selection''':選択されたテキストの インデントを解除します。テキストはBlock Indentの設定に従い右に移動します。
 
* '''Enclose selection''': ポップアップメニューにオプションが現れますから、選択部分を包む論理的な構造 (begin ... end; try ... except; try ... finally; repeat ... until; { ... } その他)を選んでください。.(Provides a pop-up menu with a number of options for logically enclosing the selected text (begin ... end; try ... except; try ... finally; repeat ... until; { ... } etc).
 
* '''大文字化''': 選択されたテキストを大文字にします。
 
* '''小文字化''': 選択されたテキストを小文字にします。
 
* '''スペースでタブを置き換え''': 選択されたテキスト内にあるTabをEnvironment -> Editor options -> General -> Tab widthsで設定された幅のスペースに変換します。 The number of spaces is not a fixed quantity, but is the number needed to fill the remaining width of the tab.
 
* '''Break lines in selection''': 80文字ないしEnvironment -> Editor options -> Display -> Right Marginで設定した値を超える長い行を改行します。この際ワードラップが行われます。If any lines in the selected text are longer than 80 characters or the number specified in Environment -> Editor options -> Display -> Right Margin, then the line is broken at a word boundary and continued on the next line.
 
* '''コメント化''': 選択されたテキストの前に//を挿入しコメント化します。
 
* '''コメント解除''': コメントマークを解除します。
 
* '''ソート''': 行(や単語やパラグラフ)をアルファベット順にソートします。昇順・降順、大文字小文字の区別の有無を選ぶことができます。もちろんソースコードの途中で実行しても意味がありませんが、リストのソートなどに便利でしょう。Sort lines (or words or paragraphs) alphabetically;  options for ascending or descending order, case sensitive or insensitive.  In the middle of program source code, of course, it makes no sense, but if you have a list you need to have sorted this will do the trick.
 
* '''選択''': ブロックやテキストの選択を行います。文書全部、括弧から括弧まで、パラグラフ一個、一行などを選択することができます。Allows selection of blocks of text.  Options include select all, select to brace, select paragraph or line etc.
 
* '''Insert from character map''': キーボードから入力できない記号を挿入します。文字の表がポップアップしますから、例えばアクサンがついた文字を選ぶとそれが挿入されます。Allows insertion of non-keyboard symbols such as accented characters, picked from a pop-up character map.
 
* '''テキストを挿入''': CVSのキーワード(著者、日付、ヘッダ等)、GPLの注意書き、ユーザ名、現在日時などの定型句をポップアップメニューから選んで挿入します。Displays pop-up menu to allow insertion of standard text such as CVS keywords (Author, Date, Header etc) or GPL notice, username or Current date and time.
 
* '''コード補完''': カーソルがある部分のコードを補完します。補完は文脈に従って実行され、作業時間をかなり短縮できます。It is context sensitive and saves you a lot of time. 例えば、この機能はプライベート変数付きでクラスを補完しますし、プロパティにアクセスするメソッドに本体を加えます。変数の代入(例えば i := 3)では変数宣言を追加します。前に宣言されている手続では、手続本体を加えます。イヴェントの設定(OnClick:=)ではメソッドの定義と本体を加えます。[[Lazarus IDE Tools]]参照のこと。For example: it completes classes, by adding private variables, Get and Set property access methods and adding method bodies. On variable assignments (e.g. i:=3;) it adds the variable declarations. On forward defined procedures it adds the procedure bodies. On event assignments (OnClick:=) it adds the method definition and the method body. See [[Lazarus IDE Tools]].
 
* '''Extract procedure''': 選択された文(一つの、ないし一連の文)を用いて新しい手続を作ります。Uses the selected text (a statement or series of statements) to build a new procedure.
 
<div style="clear:both;"></div>
 
  
==== 検索メニューThe Search sub-menu ====
+
[[Image:Component_Palette_Standard.png|size="100%]]
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/SearchMenuSnapshot.png </div>
 
* '''検索Find''': Similar to the facility in almost all graphic text editors:  a pop-up dialog box appears allowing entry of a search text string, with options such as case sensitivity, whole words, origin, scope and direction of search.
 
* '''次を検索、前を検索Find Next, Find previous''': 直前に検索した文字列を指定された方向に再検索します。Search again for the previously entered text string, in the specified direction.
 
* '''Find in files''': Search for text string in files:  pop-up dialog with options all open files, all files in project, or all directories;  masks available for selecting file types.
 
* '''置き換えReplace''': '''検索'''と同様に、Similar to '''Find''';  shows pop-up dialog with place to enter search text string and replacement text, and options for case sensitivity, direction etc.
 
* '''Incremental find''': Search for the string while you are entering the search string. Example: after you choose "Incremental Find" if you press "l" the first "l" will be highlighted. If then you press "a", the editor will find the next "la" and so on.
 
* '''行へ移動Goto line''': カーソルをファイルの指定された行へ移動させます。Move editing cursor to specified line in file.
 
* '''前へジャンプJump back''': Move back in file to next Bookmark (need to have used '''Add jump point to history''').  Will move to Bookmarks in other files open in the Editor.
 
* '''Jump forward''': Move forward to next Bookmark.
 
* '''ジャンプ・ポイントを履歴へ追加Add jump point to history''': Add Bookmarks or jump points to file.
 
* '''ジャンプ履歴を見るView Jump-History''': Look at list of bookmarks in file: '''Not implemented yet'''.
 
* '''Find other end of code block''': If positioned on a '''begin''', finds the corresponding '''end''' or vice versa.
 
* '''ブロックの先頭を検索Find code block start''': カーソルがあるプロシージャや関数の'''begin'''の位置へ移動します。Moves to the '''begin''' of the procedure or function in which the cursor is placed.
 
* '''宣言を検索Find Declaration at cursor''': 選択された識別子の宣言を検索します。Finds the place at which the selected identifier is declared.  宣言は同じファイルにあることもあれば、既に開いている他のファイルにあることもあります。もしファイルが開いていなければ、そのファイルを開きます(例えば、あるプロシージャや関数が<u>classesh.inc</u>で宣言されていたときは、そのファイルがエディタに開かれます)。This may be in the same file or another file already open in the Editor;  if the file is not open, it will be opened (so if a procedure or function is declared, for example, in <u>classesh.inc </u>, this will be opened in the Editor).
 
* '''カーソル位置のファイルを開くOpen filename at cursor''': Opens the file whose name is selected at the cursor.  <u>Include</u>ファイルやプロジェクトの他の<u>Unit</u>を含むファイルを見るときに便利です。Useful for looking at <u>Include </u> files or the files containing other <u>Units </u> used in the project.
 
* '''Goto include directive''': If the cursor is positioned in a file which is <u>Included</u> in another file, goes to the place in the other file that called the <u>Include</u> file.
 
'''<div style="clear:both;"></div>
 
  
==== 表示メニューThe View sub-menu ====
+
{{NavComponentPalette/ja}}
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ViewMenuSnapshot.png </div>
 
画面上の様々なウィンドウやパネルの表示を制御します。Controls the display of various windows and panels on the screen.
 
* '''オブジェクト・インスペクタObject Inspector''': 通常デスクトップの左側にある、フォームの情報(訳検討: 特徴?)を表示するウィンドウです。The window that usually occupies the left side of the Desktop, and displays the features of the Form which is on the desktop.  コンポーネントをクリックすると、コンポーネントの詳細がオブジェクト・インスペクタに表示されます。Clicking with the mouse on any component of the form will cause the details of that component to be displayed in the Object Inspector.  There is a panel at the top which shows the tree-structure of the current project, and the components of the form may optionally be selected in this panel:  this will also cause the corresponding details to be displayed in the Object Inspector.  The main lower panel has two tabs which allow selection of either '''Properties''' or '''Events''' to be displayed.  Selection of '''Properties''' causes features such as name, color, caption, font, size etc to be displayed:  there are two columns, the left showing the property, and the right showing the value associated with that property. Selection of '''Events''' displays two columns:  the left lists the possible events such as MouseClick or KeyDown associated with that component, and the right shows the action that results from that event.  If there is no action defined, then clicking in the appropriate box or on the <div class="box">...</div> button causes the Source Editor to be displayed, with the cursor already positioned in a dummy Procedure declaration, waiting for event-defining code to be typed in.
 
* '''ソースエディタSource Editor''': ソースコードを編集するウィンドウです。The main window in which source code is edited.  このウィンドウは他のたいていのテキストエディタと同じように動作し、従って、文書上のカーソルをマウスで移動させたり、ドラッグ操作で文字列に印をつけて選択したりできます。Its behaviour is very like that of most other graphical text editors, so that the mouse can move the cursor over the displayed text, and clicking with the left mouse button while dragging the mouse will select and highlight text.  右クリックをするとポップアップメニューが開き、切り取り、コピー、貼り付けなどの編集操作や''宣言を検索''、''カーソル位置のファイルを開く''などの操作が行えます。Right clicking with the mouse displays a pop-up menu, it includes the usual Edit Cut, Copy or Paste functions, ''Find Declaration'' and ''Open File at Cursor''.  ソースエディタの上部にはタブが並んでいて、それぞれ現在開いているプロジェクトのファイルに対応しています。The top of the Source Editor window has a number of tabs, corresponding to the files that are open for the current project;  タブをクリックするとそのファイルが表示されるので別のファイルへの切り替えが簡単にでき、また、ファイル間のコピーや貼り付けなど通常の編集のほとんどの操作が行えます。clicking on any tab makes that file visible, and you can move easily from file to file, copying and pasting between files and performing most of the normal editing functions.  ソースエディタはpunctuation mark、コメント、文字列定数などの文法要素をそれぞれ別の色で色付けします。The Source Editor performs color syntax highlighting on the code, with different colors for punctuation marks, comments, string constants etc.  It will also maintain the level of indentation from line to line as you type in code, until you change the indentation.  The function and appearance of the Source Editor are very configurable from the Main Menu by selecting Environment -> Editor options and then selecting one of several tabs in the pop-up dialog box.
 
* '''Code Explorer''': A window usually placed on the right of the Desktop which displays, in tree form, the structure of the code in the current unit or program.  It usually opens with just the Unit name and branches for Interface and Implementation sections, but clicking on the <div class="box">+</div> box to the left of any branch will open up its sub-branches or twigs, in more and more detail until individual constants, types and variables are displayed as well as procedure and function declarations.  If you change the file displayed in the main Source Editor window, you need to click on the Refresh button of the Code Explorer to display the structure of the new file.
 
* '''Units...''': Opens a pop-up dialog window with a list of the unit files in the current project.Clicking with the mouse on a filename selects that file; click on Open to display that file in the Source Editor.  Checking the Multi box allows several files to be selected simultaneously, and they will all be opened in the Source Editor (but only one at a time will be displayed).  This Menu Option is rather like the Project -> Project Inspector option, but only displays the list of Unit files and allows them to be opened.
 
* '''Forms...''': Opens a pop-up dialog window with a list of the Forms in the current project, and allows the selection of one or more of them for display.
 
* '''View Unit Dependencies''': Opens a pop-up dialog window that shows, in a tree-like manner, the structure of dependencies of the currently open unit file. Most of the files listed as dependencies will have their own <div class="box">+</div> boxes, which allow the dependencies of the individual files to be explored, often in a highly recursive manner.
 
* '''Toggle form / unit view  F12''': Toggles whether the Source Editor or the current Form is placed on the top layer of the Desktop, and given focus.  If the Source Editor has focus, then you can edit the source code;  if the Form is given focus, you can manipulate the components on the desktop and edit the appearance of the Form.  The easiest way to toggle the display between Editor and Form is to use the F12 key on the keyboard, but the same effect is achieved by selecting this option on the Main Menu.
 
* '''Messages''': A window that displays compiler messages, showing the progress of a successful compilation or listing the errors found.
 
* '''Search Results''': A window that displays the results of find in files.
 
* '''Debug windows''': Opens a pop-up menu with several options for operating and configuring the Debugger.  See below where the [[#The_Debugger|debugger]] is described.
 
<div style="clear:both;"></div>
 
  
==== プロジェクト メニュー ====
+
それぞれのタブは機能ごとに分けられており、異なった組のアイコンからなります。 全てのタブでは、一番左に矢印のアイコンがあります。これは選択ツール(Selection Tool)と呼びます。
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ProjectMenuSnapshot.png </div>
 
* '''新規プロジェクト''': 新しいプロジェクトを作ります。ポップアップ・ダイアログから、プロジェクトの種類を選択します。
 
* '''New Project from file''': A Navigation dialog window appears, alowing selection of a file from which to create a new project.
 
* '''プロジェクトを開く''': 既存のプロジェクトを開きます。A navigation dialog appears with a list of Lazarus Project Information (.lpi) files from which a project may be chosen.
 
* '''最近のプロジェクトを開く''': 最近のプロジェクトのリストから一つ選び、プロジェクトを開きます。
 
* '''プロジェクトを保存''': 「フィアル」→「保存」と同じように、現在のプロジェクトのファイルを全て保存します。プロジェクトを初めて保存する場合は、ファイル名を求めるプロンプトが開きます。(「名前を付けてプロジェクトを保存...」と同じ状態になります。)
 
* '''名前を付けてプロジェクトを保存...''': プロンプトにファイル名を入力し、プロジェクトを保存します。A default filename of Project1.lpi is offered, but you should choose your own filename.  Lazarusではプロジェクトとユニットに同じ名前を付けてはいけません([[#The_Lazarus_files |下記]]を見よ)。
 
* '''Publish Project''': Creates a copy of the whole project. If you want to send someone just the sources and compiler settings of your code, this function is your friend. A normal project directory contains a lot of information. Most of it is not needed to be published: the .lpi file contains session information (like caret position and bookmarks of closed units) and the project directory contains a lot of .ppu, .o files and the executable. To create a lpi file with only the base information and only the sources, along with all sub directories use "Publish Project". In the dialog you can setup the exclude and include filter, and with the command after you can compress the output into one archive. See [[Lazarus IDE Tools]]
 
* '''Project Inspector''': Opens a pop-up dialog with a tree-like display of the files in the current project.  Allows you to add, remove or open selected files, or change options of the project.
 
* '''Project Options...''': Opens a pop-up dialog window with tabs for setting options for Application (Title, Output Target file name), Forms (allowing you to select among the available forms, make them Auto-create at start of application) and Info (specifying whether editor information should be saved for closed files, or only for project files).
 
* '''Compiler options ...''': (Recently moved here from the Run Menu). Opens a multi-page tabbed window which allows configuration of the compiler.  Tabs include '''Paths''' which allows definition of search paths for units, include files, libraries etc, as well as allowing choice of widget type for the forms (gtk, gnome, win32); '''Parsing''' which allows choice of rules for parsing source programs, '''Code''' which allows choice of optimisation for faster or smaller programs, choice of target processor, types of checks, heap size etc; '''Linking''' allowing choice of whether or how to use debugging, static or dynamic libraries, and whether to pass options through to the linker; '''Messages''' to define what type of messages should be generated during error conditions; '''Other''' which allows decision to use default configuration file (fpc.cfg) or some other file; '''Inherited''' which shows a tree structure diagram to indicate how options have been inherited from units already incorporated; '''Compilation''' which allows definition of commands to be executed before or after the compiler is launched and can allow use of Make files.
 
* '''Add editor file to Project''': Add the file currently being edited to the Project
 
* '''プロジェクトから取り除く''': Gives a pop-up menu of files available for removal from project.
 
* '''View Source''': No matter which file you are editing, takes you back to the main program file (.lpr)or the main .pas file if there is no .lpr.
 
* '''View ToDo List''':Opens a dialog box with a list of ToDo items associated with this project. This will list any ToDo comments in your project (lines commencing //TODO), and any others in the Lazarus units you have used. You need to Refresh the ToDo items in the dialog (using arrow symbol button of toolbar) before new 'ToDos' appear. The first column of the ToDo list contains numbers you have allocated to your ToDo comments; a simple //TODO comment will appear as a zero, but a comment of //TODO999 (for example) will place the number 999 in the first column. Remember there should be no spaces on the line before //TODO and ToDo comments added after the last save will not be shown!
 
  
==== 実行メニューThe Run sub-menu ====
+
マウスカーソルをコンポーネントパレットのアイコンの上に移動して、しばらくクリックしないで待つと、アイコンが意味するコンポーネントの名前がポップアップします。 それらの名前がすべて 'T' で始まることに注意してください。これは、そのコンポーネントの 「型:'Type'」 、正確に言うとコンポーネントの 「クラス:'Class'」 を示しています。
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/RunMenuSnapshot.png </div>
 
* '''構築Build''': Lazarusを起動し、前回の構築から変更されたプロジェクトのファイルを全て構築(つまりコンパイル)します。Causes Lazarus to build (ie compile) any files in the project that have been changed since the last build.
 
* '''全て構築Build all''': 変更の有り無しに関わらず、プロジェクトの全てのファイルを構築します。Builds all files in the project, whether or not there have been any changes.
 
* '''構築を中止Abort build''': 愚かなことをしたのを思い出し構築を止めたいときや、明らかにどこかがおかしくて構築に時間がかかり過ぎているときに、実行中の構築を中止します。Stop the build process once it is running - either you have remembered that you did something silly and want to stop the build, or the system seems to be taking far too long and something is obviously wrong.
 
  
* '''実行Run''': This is the usual way to  launch the compiler and, if compilation is successful, to start execution of the application.  What actually happens is that Lazarus saves a copy of your files, then starts the compiler and linker, then begins execution of the final linked binary program.
+
コンポーネントをフォームに加えると、その [[Class]] が [[Unit]] の '''[[Interface]]''' 部の '''[[Type]]''' セクションに追加されます。(通常は TForm1 の定義の一部として) 同時に、そのクラスの '''instance''' '''[[Var]]''' セクションに加えられます(通常、Form1という名前の変数として)。 フォームやコンポーネントが用いる '''Methods''' は、全て(つまり全ての [[Procedure]] と [[Function]] )、そのユニットの '''[[Implementation]]''' 部で宣言する必要があります。
* '''一時停止Pause''': 現在実行中のプログラムの実行を一時停止します。Suspend execution of the currently running program.  This may allow you to inspect any output that has been generated; execution may be resumed by selecting '''Run''' again.
 
* '''Step into''': Used in conjunction with the debugger, causes execution of the program    one step at a time up to a bookmarked point in the source.
 
* '''Step over''': Causes stepwise execution up to the statement marked, then skips the marked statement, and continues execution at normal speed. Useful in trying to isolate a statement that introduces a logical error.
 
* '''Run to cursor''': Causes execution at normal speed (ie NOT one statement at a time) until the statement is reached where the cursor is located;  then stops.  Resume execution at normal speed by selecting '''Run'''.
 
* '''中止Stop''': 実行中のプログラムを中止します。Cease execution of the running program.  '''実行'''を選んでも再開はできません。'''実行'''を選ぶと、(必要ならば再コンパイルし)プログラムを最初から実行します。Cannot be resumed by selecting '''Run''';  this will start the program again from the beginning (re-compiling if necessary).
 
  
* '''Run Parameters''': Opens a multi-page pop-up window which allows command-line options and parameters to be passed to the program to be executed;  allows selection of display to run program (eg a remote X terminal may be used in Linux);  some system Environment variables may be overridden.
+
==== コンポーネントのサンプルプログラム ====
: One very important use of this sub-menu is to activate a terminal window in which conventional Pascal console input/output is displayed.  If you are developing a console-mode Pascal program (ie one that doesn't use the Graphical User Interface with its forms, buttons and boxes) then you should check the box for "Use launching application". The first time you do this and try the Compile/Run sequence, you will probably get a rude message to say
+
コンポーネントのサンプルプログラムは、 $LazarusPath/lazarus/examples に保存されています。
"xterm: Can't execvp /usr/share/lazarus//tools/runwait.sh: Permission denied". 
 
: If this happens, you need to change the permissions on the appropriate file (for example using chmod +x ''filename'', or using the Windows utility for changing permissions); you might have to do this as root. After this, each time you launch you program, a console box will appear and all your text i/o (readln, writeln etc) will appear in it.
 
: After your program has finished execution, a message "Press enter" appears on the screen.  Thus any output your program generated will remain on the screen until you have had a chance to read it;  after you press 'enter' the console window closes.
 
: See the separate tutorial on [[Console Mode Pascal]] programming.
 
* '''Reset debugger''': Restores the debugger to its original state, so that breakpoints and values of variables etc are forgotten.
 
  
* '''Build file''': Compile (build) just the file that is currently open in the Editor.
+
多くのプログラムで、IDEやコンポーネントパレットを使わないでダイアログや他のコンポーネントを利用する方法が分かるでしょう。全てのコンポーネントは、明確に主となるpascalプログラムで定義されています。 IDEを大いに利用するサンプルもあります。
* '''Run file''': Compile, link and execute just the currently open file.
 
* '''Configure Build + Run File''': Opens a multi-page tabbed window with options to allow for build of just this file when '''Build Project''' is selected, allows selection of the working directory, the use of various Macros, etc.  Then Builds and Runs the file.
 
:These last three options enable you to open (and maintain) a test project. Use File -> Open to open an .lpr file, pressing cancel on the next dialog to open this file as "normal source" file.
 
  
<div style="clear:both;"></div>
+
サンプルプログラムの中には、そのままでは動作しないものもあるでしょう。ファイルやディレクトリのパス、パーミッションを設定する必要があるかも知れません。サンプルプログラムをコンパイルするにあたり、ファイル及びディレクトリに対する 読み/書き/実行 (read/write/execute) のパーミッションを確認して下さい。または適切なパーミッションを持ったディレクトリにファイルをコピーしてください。
  
==== The Components sub-menu ====
+
まずは、'testall' プログラムを実行してみましょう。利用可能なコンポーネントのメニューと簡単な実行例があります。コードを読んでどう動いているか調べてみましょう!
* '''Open Package''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/OpenPackageSnapshot.png list of installed packages], with an invitation to [http://lazarus-ccr.sourceforge.net/kbdata/PackageContentsSnapshot.png open one or more of them], or to select various general or compiler options.
 
* '''Open Package File''': Open one of the files in the selected package.
 
* '''Open Recent Package''': Open a package that was opened recently.
 
* '''Add Active Unit to Package''': Place the unit file (currently in the editor) into a package.
 
* '''Package Graph''': Displays a [http://lazarus-ccr.sourceforge.net/kbdata/PackageGraphSnapshot.png graph] showing the relationships of the packages currently being used (if you aren't using any other packages, the Lazarus package and the FCL and LCL will be displayed).
 
* '''Configure custom components''': If you have created some components, allows you to configure them.
 
  
==== ツールメニュー The Tools sub-menu ====
+
==== コンポーネントの一覧 ====
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/ToolsMenuSnapshot.png </div>
+
コンポーネントの一覧を以下に示します。各ユニットには、それらの解説するページへのリンクが張ってあります(ないのもあります)。 あるコンポーネントのプロパティについて知りたければ、そのコンポーネントの継承を調べ、継承元となるコンポーネントについて調べるとよいでしょう。 例えば、TMaskEdit について理解することは、 TCustomMaskEditについて調査する際にも役に立ちます。
* '''カスタムメニューの構成''' '''Configure custom tools''': ツールキットに様々な外部ツール(普通、マクロです)を加えることができます。
+
   
* '''お手軽文法チェック''' '''Quick syntax check''': 実際にコンパイルすることなく、手早くソースの文法チェックを行います。大きく複雑なプログラムを組む際は必須の機能です。時間をかけてコンパイルした挙げ句エラーで止まるのはやるせないでしょう。
+
'''タブの名前''' (タブ自体の名前がおよその説明になっています。)
* '''閉じられていないブロックの推定''' '''Guess unclosed block''': 複雑にネストされたブロック構造を組んで、endを入れ忘れた際便利です。
 
* '''IFDEF/ENDIFのミスタイプの推定''' '''guess misplaced IFDEF/ENDIF''': 複雑にネストされたマクロ構造を組んで、ENDIFを入れ忘れた気がする際便利です。
 
* '''文字列をリソースにする''' '''Make resource string''': 選択された文字列をリソースセクションに置き、リソースとして扱えるようにします。リソースにしておけば、プロジェクトをコンパイルし直さなくてもそれを変更することができます。
 
* '''差分''' '''Diff''': 二つのファイル(あるいは同じファイルの二つの版)を比較し、相違点を見つけます。行頭行末のホワイトスベースを無視したり、行末記号の相違(CR+LFとLF)を無視したりするオプションがあります。最後のCSV更新等の後に変更があったかどうか調べるのに便利です。
 
* '''LFMファイルをエディタで調べる''' '''Check LFM file in editor''': 現在のフォームを記述するための設定を含む LFM ファイルを調べるのに用いることができます。
 
* '''DelphiユニットのLazarusユニットへの変換''' '''Convert Delphi unit to Lazarus unit''': DelphiアプリケーションをLazarus用にする際役立ちます。ソースファイルに必要な変更を行います。[[Lazarus For Delphi Users]] 及び [[Code Conversion Guide]] 参照のこと。
 
* '''DFM ファイルの LFM への変換''' '''Convert DFM file to LFM''': DelphiからLazarusへのポーティングの際、Delphiのフォーム定義ファイルをLazarusのものに変換します。[[Lazarus For Delphi Users]] と [[Code Conversion Guide]] 参照のこと。
 
* '''Lazarus のビルド''' '''Build Lazarus''': Lazarus のリビルドを開始します。ダウンロードあるいはアップデートした最新の CVS ファイルを元にします。ボタンを押したら腰を落ち着けて何が起きるか見ましょう('''Messages'''ウィンドウに注目)
 
* '''「Lazarusのビルド」の構成''' '''Configure "Build Lazarus"''': Lazarus のどの部分をどのようにリビルドするか設定します。例えばLCLのみのビルド、サンプル以外全てのビルドなどです。利用する LCLインターフェース の種類(ウィジェットのセット)、ターゲットOS・ターゲットディレクトリを選択することもできます。
 
<div style="clear:both;"></div>
 
  
==== The Environment sub-menu ====
+
* '''[http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/index-4.html Standard]'''(基本:コンポーネントの記述は、[[Standard tab/ja|Standard タブ]] にあります)。
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/EnvironmentMenuSnapshot.png </div>
+
<center>[[Image:Component_Palette_Standart.png]]</center>
* '''環境設定''' '''Environment options''': 複数のページを持つウィンドウが現れます。次のようなタブがあります。
+
: [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tmainmenu.html TMainMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/menus/tpopupmenu.html TPopupMenu], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tbutton.html TButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlabel.html TLabel], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tedit.html TEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tmemo.html TMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/ttogglebox.html TToggleBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcheckbox.html TCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tradiobutton.html TRadioButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tlistbox.html TListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tcombobox.html TComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tscrollbar.html TScrollBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tgroupbox.html TGroupBox],[http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tradiogroup.html TRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tcheckgroup.html TCheckGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpanel.html TPanel], [http://lazarus-ccr.sourceforge.net/docs/lcl/actnlist/tactionlist.html TActionList]
** '''Files''' - 省略時ディレクトリ、コンパイラのあるディレクトリ、ソースのあるディレクトリ、コンパイラが一時的に用いるティレクトリを指定することができます。
 
** '''Desktop''' - 次の項目のオプションを指定します。言語、自動保存の動作、デスクトッププロパティの保存、コンポーネントパレットやスピードボタンのヒント。
 
** '''Windows''' - 様々なウィンドウの大きさや動作を指定することができます。
 
** '''Form Editor''' - フォームを編集する際の色を選べます。
 
** '''Object Inspector''' - 色と各項目の高さを選べます。
 
** '''Backup''' - 編集時のバックアップファイルについて指定します。
 
** '''Naming''' - Pascalファイルの拡張子(.pas, .pp, .p)、保存するファイルの名を小文字にするか、名前の自動削除と自動改名を設定するかを選びます。
 
* '''エディタ''' '''Editor options''': 複数のページを持つウィンドウが現れます。次のようなタブがあります。
 
** '''General''' - 自動インデント、括弧の強調表示、ドラッグ&ドロップ編集、スクローリング、文法強調、ヒント表示、ブロックインデントとタブの字数、Undo可能な回数などを設定します。
 
** '''Display''' - 行数表示の有無、ガター(画面左のブロック表示制御)の有無、エディタのフォントと文字の大きさを設定します。プレビュー画面があり、注釈・コンパイラ指令・punctuation・エラー・ブレークポイントの表示具合がわかります。
 
** '''Key Mappings''' - キー操作を Lazarus 流にするか Turbo Pascal 流にするか決めます。
 
** '''Color''' - エディタの文字の色使いを選びます。Object Pascal、C++、Perl、HTML、XML、各種シェルスクリプトのような様々な言語向けの設定があり、各言語のプレビューが表示されます。
 
** '''Code Tools''' - 識別子の補完、tooltipsを設定します。
 
* '''コードのテンプレート''' '''Code Templates''': コード補完用テンプレートのファイル名といった設定が可能です。
 
* '''デバガ''' '''Debugger Options''': 複数のページを持つウィンドウが現れます。次のようなタブがあります。
 
  
** '''General''' - デバガを選びます。デバガなし、GNU debugger (gdb)、SSH(セキュアシェル)経由のgdbを選ぶことができます。デバガを検索するパス名、デバガに指定するオプションを設定することができます。
+
* '''[http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/index-4.html Additional]''' (追加:コンポーネントの自体は、[[Additional tab/ja|Additionalタブ]] もご覧下さい。)
** '''Event log''' - ログを初期化するか、何行まで受け入れるかを指定します。
+
<center>[[Image:Component_Palette_Additional.png]]</center>
** '''Language Exceptions''' - 無視する例外を指定します。
+
:[http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tbitbtn.html TBitBtn], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttons/tspeedbutton.html TSpeedButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/stdctrls/tstatictext.html TStaticText], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/timage.html TImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tshape.html TShape], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tbevel.html TBevel], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tpaintbox.html TPaintBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tnotebook.html TNotebook], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tlabelededit.html TLabeledEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tsplitter.html TSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttrayicon.html TTrayIcon], [http://lazarus-ccr.sourceforge.net/docs/lcl/maskedit/tmaskedit.html TMaskEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/checklst/tchecklistbox.html TCheckListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tscrollbox.html TScrollBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplicationproperties.html TApplicationProperties], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tstringgrid.html TStringGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/grids/tdrawgrid.html TDrawGrid], [http://lazarus-ccr.sourceforge.net/docs/lcl/pairsplitter/tpairsplitter.html TPairSplitter], [http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorbox.html TColorBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/colorbox/tcolorlistbox.html TColorListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/chart/index.html TChart]
** '''OS Exceptions''' - 特定のシグナルを現在走行中のOSに向けて発行することができます(実装されていません)。
 
* '''コードツール''' '''Code Tool Options''': 複数のページを持つウィンドウが現れます。次のようなタブがあります。
 
** '''General''' - ソースを検索するための付加的なパスを指定します。またどのようにジャンプするかを指定します。
 
** '''Code Creation''' - エディタが生成したコードをどこに追加するか決めます。さまざまな要素の前か後かで指定します。
 
** '''Words''' - Pascal のキーワードを大文字、小文字、先頭だけ大文字のどれで追加するか指定します。
 
** '''Line Splitting''' - 改行規則を定義します。特定のキーワードの後、特定の記号の前後などです。
 
** '''Space''' - 特定の文法要素・記号の前や後で自動的に空白を挿入するか指定します。
 
* '''コードツールの定義を編集する''' '''Code Tools Defines Editor''': ここでは IDE がソースコードを解析(パージング)するために内部的に利用している定義を全て見ることができます。すべての define、ユニット、ソース、すべてのソースディレクトリに対するインクルードパスです。現行の FPCの設定 から始まり、Lazarus ソースディレクトリ、全パッケージのディレクトリ、プロジェクトのディレクトリに至ります。これらはほとんどが自動的に生成され、読み出し専用です。
 
* '''FPCソースディレクトリの再走査''' '''Re-scan FPC Source directory''' を実行すると、ディレクトリ全体を調査します。Lazarus はイヴェントハンドラを正しく生成したり、宣言を探索したりするために FPC のソースを利用します。環境設定でソースディレクトリを変更した際は、Lazarus が確実にそのディレクトリに含まれるヴァージョンのソースを利用することができるように、ディレクトリを再走査します。しかし、Lazarus が知らないうちにディレクトリが変更されると、フォームをデザインする際または「宣言を検索する」 "Find declaration" を実行する際にエラーとなる場合があります。その場合は、次の二つのどちらかを行ってください。
 
*# 環境設定のFPCソースディレクトリを確かめる
 
*# FPCソースディレクトリの再走査を実行する
 
  
==== ウィンドウメニュー The Windows sub-menu ====
+
* '''[http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/index-4.html Common Controls]''' (コンポーネントの記述は、 [[Common Controls tab]] にあります。)
<div class="floatright"> http://lazarus-ccr.sourceforge.net/kbdata/WindowsMenuSnapshot.png </div>
+
<center>[[Image:Component_Palette_Common_Controls.png]]</center>
現在開いているファイルと利用可能なウィンドウ(ソースエディタ、オブジェクトインスペクタ、プロジェクトインスペクタなど)のリストです。ウィンドウの名前をクリックするとそれが最前面に移動し、フォーカスがあたります。<div style="clear:both;"></div>
+
:[http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttrackbar.html TTrackBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tprogressbar.html TProgressBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttreeview.html TTreeView], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tlistview.html TListView], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tstatusbar.html TStatusBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttoolbar.html TToolBar], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tupdown.html TUpDown], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/tpagecontrol.html TPageControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/ttabcontrol.html TTabControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/comctrls/theadercontrol.html THeaderControl], [http://lazarus-ccr.sourceforge.net/docs/lcl/controls/timagelist.html TImageList], [http://lazarus-ccr.sourceforge.net/docs/lcl/popupnotifier/index.html TPopupNotifier]
 
 
==== ヘルプメニュー The Help sub-menu ====
 
 
 
いまのところ、三つの設定項目があります At present this has three selections:
 
* '''オンラインヘルプ''' '''Online Help''' 現状では、Webブラウザが開き走るチーターが表示されます。Lazarus、FreePascal、Wikiへのリンクがあります。
 
* '''ヘルプの構成''' '''Configure Help''' ポップアップメニューが現れ、ヘルプを読むためのビューア、データベースを選択することができます。Lazarus-CCR ウェブサイト、ドキュメントを含む他のウェブサイト、あるいはオフラインでも読むことのできるローカルに保存されたドキュメントを選ぶことができます。ヘルプシステムが完成した暁には、ローカルなドキュメントがデフォルトになりますが、いまのところオンライン検索がデフォルトになっています。Free Pascalのライブラリ(Components Library, FCL、またはランタイムライブラリ, RTL。Lazarus Component Library, LCL は含まれません)に属するなんらかのキーワードの上にエディタのカーソルを置き <<F1>> キーを押すと、ウェブサイトにあるヘルプを見ることができます。'''この項目は現在作業中です'''
 
* '''Lazarusについて''' '''About Lazarus''' Lazarus に関する情報を表示します。
 
 
 
将来的には、完全なオンラインヘルプが用意されます。そこでは、Pascalの文法、IDEの使い方、コンポーネントの使い方・改造法・新規作成法、特定のタスクを行うためのヒントが提供されます。皆さんがいまお読みになっているこのセクションはそのための第一歩です。'''私と思わん方はどなたでもドキュメント整備に参加してください。Wiki上での編集はとても容易です。'''
 
  
=== The Button bar ===
+
* '''[http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/index-4.html Dialogs]''' (コンポーネントの記述は、 [[Dialogs tab]] にあります。)
小さなツールバーがメインエディタウィンドウの左、メインメニューの直下、コンポーネントパレットの左にあります。このツールバーには、メインメニューの項目の中で頻繁に用いられるものに対応するボタンがあります:
 
: '''New unit'''(新しいユニット)、'''Open''' (開く。下向き矢印を押すと最近用いたファイルの一覧が現れます)、'''Save'''(保存)、'''Save all'''(全保存)、'''New Form'''(新しいフォーム)、'''Toggle Form/Unit'''(ユニット表示におけるフォームとソースの切り替え)、'''View Units'''(ユニットを見る)、'''View Forms'''(フォームを見る)'''Run'''(実行。コンパイルして実行します)、'''Pause'''(実行の一時停止)、'''Step Into'''(ステップイン)、'''Step over'''(ステップオーヴァー)。最後の二つはデバガ関係の機能です。
 
 
 
== The Component Palette ==
 
沢山のアイコンが並んだタブ付きのツールバーがあり、これをコンポーネントパレットと呼びます。それらのアイコンはフォームを作成する際よく用いられるコンポーネントを表しています。
 
 
 
タブを押すと、異なった組のアイコンが表示されます。コンポーネントは機能別に分類してあります。全てのタブで、一番左のアイコンは斜め左を向いた矢印になっており、これを選択ツール Selection Tool と呼びます。
 
 
 
マウスカーソルをコンポーネントパレットのアイコンの上に持っていき、しばらくクリックしないで待つと、それぞれのコンポーネントの名前がポップアップします。それらの名前がすべて 'T' で始まることに注意してください。これはそのコンポーネントの 「型」 (Type) 、もっと正確に言うと「クラス」 (Class) を示しています。コンポーネントをフォームに加えると、そのクラスがユニットの '''interface''' 部の '''type''' セクションに書き加えられます(通常、TForm1 の定義の一部として)。同時にその型の'''インスタンス''' instance が一つ、'''var''' セクションに加えられます(通常、Form1という名前の変数として)。フォームやコンポーネントが用いる'''メソッド''' method は全て(つまりは手続と関数は全て)、そのユニットの '''implementation''' 部におかなければなりません。
 
 
 
次にコンポーネントの一覧を示しますが、それらが定義されたユニットを解説するページへのリンクが張ってあります(ないのもあります)。あるコンポーネントのプロパティについて知りたければ、それがどんなコンポーネントを継承しているかを調べ、元のコンポーネントについて調べるとよい場合がしばしばあります。例えば、TMaskEdit について理解していれば、TCustomMaskEditを調べる際に有用です。
 
 
'''タブの名前''' (名前を見るだけでどのようなものか大体わかるでしょう):
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=StdCtrls Standard]'''(標準)
 
<center>[[Image:Component_Palette_Standart.png]]</center>
 
:''頻用されるコンポーネント:'' [http://lazarus-ccr.sourceforge.net/index.php?wiki=MenuUnit TMainMenu], [http://lazarus-ccr.sourceforge.net/index.php?wiki=MenuUnit TPopupMenu], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TButton], TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox, TStaticText, [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TRadioGroup], TCheckGroup, [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TPanel], TActionList
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls Additional]'''(拡張)
 
<center>[[Image:Component_Palette_Additional.png]]</center>
 
:''しばしば用いられるコンポーネントや追加のコンポーネント:'' [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TBitBtn], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ButtonsTxt TSpeedButton], [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TImage], TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, [http://lazarus-ccr.sourceforge.net/index.php?wiki=MaskEdit TMaskEdit], TCheckListBox, [http://lazarus-ccr.sourceforge.net/index.php?wiki=FormsTxt TScrollBox], [http://lazarus-ccr.sourceforge.net/index.php?wiki=FormsTxt TApplicationProperties], TStringGrid, TDrawGrid, TPairSplitter
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=ComCtrls Common Controls]'''(よくあるコントロール)
 
<center>[[Image:Component_Palette_Common_Controls.png]]</center>
 
: TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TImageList
 
* '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt Dialogs]'''(ダイアログボックス)
 
 
<center>[[Image:Component_Palette_Dialogs.png]]</center>
 
<center>[[Image:Component_Palette_Dialogs.png]]</center>
: TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog
+
:[http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/topendialog.html TOpenDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tsavedialog.html TSaveDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tselectdirectorydialog.html TSelectDirectoryDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcolordialog.html TColorDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfontdialog.html TFontDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tfinddialog.html TFindDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/treplacedialog.html TReplaceDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/topenpicturedialog.html TOpenPictureDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tsavepicturedialog.html TSavePictureDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalendardialog.html TCalendarDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/extdlgs/tcalculatordialog.html TCalculatorDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html TPrinterSetupDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintdialog.html TPrintDialog], [http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/tcustomprintersetupdialog.html TPageSetupDialog]
 
 
パレットには含まれていませんが、他にもいくつかの便利な '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples ダイアログ]'''手続きや関数があります。それらはソースプログラムから容易に呼び出すことができます。
 
  
コンポーネントの利用法については、ソースをインストールする際、いくつかの好例を $LazarusPath/lazarus/examples に入れてありますのでご覧ください。その中にIDEを使ってフォーム上に配置することなしに、Pascalプログラムから直接、明示的にダイアログボックス他のコンポーネントを用いる完全な方法が数多く示されています。またIDEを使い倒したプログラム例もあります。
+
パレットに含まれていませんが、他にもいくつかの便利な '''[http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogExamples ダイアログ]'''手続きや関数があります。それらはソースプログラムから直接に呼び出せ、簡単に利用できます。
  
サンプルプログラムの中には、そのままでは動作しないものもあるでしょう。ファイルやディレクトリのパス、パーミッションをご自身で設定する必要があります。サンプルプログラムをコンパイルするには、そのファイル及びディレクトリに対し読み書き実行 read/write/execute のパーミッションが必要です。あるいは適当なパーミッションを持ったディレクトリにファイルをコピーしてください。
 
  
'testall' プログラムを走らせてみましょう。利用可能なコンポーネントのメニューを見ることができ、多くの場合、簡単なテストフォームの例があります。そうしたら、コードを読んでどうなっているか調べてみましょう!
 
 
* '''Misc'''(その他)
 
* '''Misc'''(その他)
 
<center>[[Image:Component_Palette_Misc.png]]</center>
 
<center>[[Image:Component_Palette_Misc.png]]</center>
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt TColorButton], TSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox  
+
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=DialogsTxt TColorButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tspinedit.html TSpinEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/spin/tfloatspinedit.html TFloatSpinEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/arrow/tarrow.html TArrow], [http://lazarus-ccr.sourceforge.net/docs/lcl/calendar/tcalendar.html TCalendar], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/teditbutton.html TEditButton], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tfilenameedit.html TFileNameEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdirectoryedit.html TDirectoryEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tdateedit.html TDateEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/editbtn/tcalcedit.html TCalcEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/filectrl/tfilelistbox.html TFileListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/xmlpropstorage/txmlpropstorage.html TXMLPropStorage], [http://lazarus-ccr.sourceforge.net/docs/lcl/inipropstorage/tinipropstorage.html TIniPropStorage], [http://lazarus-ccr.sourceforge.net/docs/lcl/chart/tbarchart.html TBarChart], [http://lazarus-ccr.sourceforge.net/docs/lcl/buttonpanel/tbuttonpanel.html TButtonPanel], TIDEDialogLayoutStorage
* '''Data Controls'''(データ)
+
 
 +
* '''[http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/index-4.html Data Controls]'''(データの制御。Standard及びAdditionalグループに似ていますが、データベースに適用できます)
 
<center>[[Image:Component_Palette_DataControls.png]]</center>
 
<center>[[Image:Component_Palette_DataControls.png]]</center>
: ''データ関連のコントロール。Standard及びAdditionalグループに似ていますが、データベースに対して用いることができます:'' TDBNavigation, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox,TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TdbGrid
+
:[http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbnavigator.html TDBNavigator], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbtext.html TDBText], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbedit.html TDBEdit], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbmemo.html TDBMemo], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbimage.html TDBImage], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdblistbox.html TDBListBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcombobox.html TDBComboBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcheckbox.html TDBCheckBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbradiogroup.html TDBRadioGroup], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbcalendar.html TDBCalendar], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbctrls/tdbgroupbox.html TDBGroupBox], [http://lazarus-ccr.sourceforge.net/docs/lcl/dbgrids/tdbgrid.html TDBGrid]
 +
 
 
* '''Data Access'''(データへのアクセス)
 
* '''Data Access'''(データへのアクセス)
 
<center>[[Image:Component_Palette_DataAccess.png]]</center>
 
<center>[[Image:Component_Palette_DataAccess.png]]</center>
: TDatasource
+
: TDatasource, TMemDataset, TSdfDataSet, TFixedFormatDataSet, TDbf
 +
 
 
* '''System'''(システム)
 
* '''System'''(システム)
 
<center>[[Image:Component_Palette_System.png]]</center>
 
<center>[[Image:Component_Palette_System.png]]</center>
: [http://lazarus-ccr.sourceforge.net/index.php?wiki=ExtCtrls TTimer], TIdleTimer, TProcess
+
:[http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/ttimer.html TTimer], [http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/tidletimer.html TIdleTimer], [http://lazarus-ccr.sourceforge.net/docs/lcl/lresources/tlazcomponentqueue.html TLazComponentQueue], [http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlhelpdatabase.html THtmlHelpDatabase], [http://lazarus-ccr.sourceforge.net/docs/lcl/lazhelphtml/thtmlbrowserhelpviewer.html THtmlBrowserHelpViewer], [http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tprocessutf8.html TProcessUTF8], [http://lazarus-ccr.sourceforge.net/docs/lcl/asyncprocess/tasyncprocess.html TAsyncProcess], [[doc:fcl/process/tprocess.html|TProcess]], TSimpleIPCClient, TSimpleIPCServer, TXMLConfig, TEventLog
* '''SynEdit'''
+
 
 +
* '''SynEdit'''(SynEdit:他の言語や開発ツールへのインターフェースとなるコンポーネント[http://synedit.sourceforge.net/ sourceforge])
 
<center>[[Image:Component_Palette_SynEdit.png]]</center>
 
<center>[[Image:Component_Palette_SynEdit.png]]</center>
: ''他の言語や開発ツールとのインターフェースのためのコンポーネントです。Borland Delphi, Kylix  and C++Builder用の複数行編集コントロールですが、文法ハイライト機能やコード補完機能、HTMLやTeX、RTFへのエクスポート機能を持っています。これは完全なVCL/CLXコントロールであり、Microsoft Windows のコントロールのラッパーではなく、ランタイムライブラリを必要としないことにご注意ください。そのため SynEdit はクロスプラットフォームで利用できます。これは Lararus IDE の編集コンポーネントで、FreePascalとの互換性も計画されています。 [http://synedit.sourceforge.net synedit at sourceforge]を参照のこと。TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynMultiSyn
+
: TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynFreePascalSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynVBSyn, TSynAnySyn, TSynMultiSyn
 +
 
 +
SynEditは、 Borland Delphi, Kylix と C++Builder用の複数行編集コントロールであり、文法ハイライト機能やコード補完機能、HTMLやTeX、RTFへのエクスポート機能を持っています。これは完全なVCL/CLXコントロールであり、Microsoft Windows のコントロールのラッパーではなく、ランタイムライブラリを必要としない、クロスプラットフォームで利用できるコンポーネントです。FreePascalとの互換性も計画されており、 Lararus IDE をエディタも SynEditが利用されています。[http://synedit.sourceforge.net/ sourceforge]も参照ください。
 +
 
 +
==== コンポーネントパレットの使い方 ====
 +
 
 +
コンポーネントパレットの利用にあたっては、フォームが作成されており、エディタ上で見えている必要があります(フォームが無い場合は、 File -> New Form で新たなフォームが作成してください)。 次に、使いたいコンポーネントのアイコンをクリックして選択し、フォーム上のコンポーネントを配置したい位置でクリックすることで、選択されたコンポーネントが配置されます。 コンポーネントの移動やサイズの調整は、マウスで直接操作することでもできますし、コンポーネントのプロパティの値をオブジェクトエディタから直接操作することでもできます。
 +
 
 +
コンポーネントを新たに追加したときには(自作や他のパッケージから追加するなど)、コンポーネントパレットに新しいタブが現れ、コンポーネントに応じたアイコンが表示されます。それらは他のコンポーネントと同様に使用できます。
  
パレットを用いるには、フォームが開いてあり、エディタの中で見えていなければなりません(そうでなければ File -> New Form でフォームを作成してください)。適当なタブを選択し、必要なコントロールを表すアイコンをクリックします。次にフォームの上で、コントロールを配置したい所を大体決めたらそこをクリックします。コンポーネントが現れ、それをマウスでクリックして選択することができるようになります。フォーム上の正確な位置に移動し、必要とする大きさなるようにサイズを調整してください。移動や調節はフォーム上でマウスを用いても行えますし、オブジェクトエディタでそれぞれのプロパティを操作しても行えます。
+
== デバッガ ==
 +
: (まだ書かれていません)
  
自作か、あるいは他のパッケージからか、何らかの方法で新しいコンポーネントをインストールすると、コンポーネントパレットに新しいタブが現れ、それぞれのコンポーネントに応じたアイコンが表示されます。それらはデフォルトで含まれたコンポーネントと同様に用いることができます。
+
== Lazarusのファイルについて ==
  
== The Debugger ==
+
ファイルの保存操作をすると、次の二つのファイルを保存することになります:
: ''Still to be written''.
 
  
== The Lazarus files ==
+
  xxx.pas
    (Thanks to Kevin Whitefoot.)
+
  yyy.lpr
    (Additions by Giuseppe Ridinò, [[User:Kirkpatc]] and Tom Lisjac)
 
ファイルの保存操作をすると、実際には次の二つのファイルを保存することになります:
 
  
  xxx.pas and yyy.lpr
+
他にも保存されるファイルはありますが、あなたが名前をつけられるのはこの二つです。
(他にも保存されるファイルはありますが、あなたが名前をつけられるのはこの二つです。) プロジェクトファイル (lpr) 及びユニットファイル (pas) は同じ名前であってはいけません(訳注: xxx ≠ yyyであるべきだ、の意味)。Lazarus はユニットの名前(ソースコードに現れる名前)をユニットファイル名(xxxの部分)と同じになるように、またプログラムの名前をプロジェクトファイル名(yyyの部分)と同じになるように設定するからです(そうしないと、コンパイラはプロジェクトファイルの中で参照されても、そのユニットを探し出せなくなってしまうでしょう)。一貫性を維持するために、当然ソースの中に現れる全ての unit1 は xxx に変更されることになります。
+
プロジェクトファイル (lpr) 及びユニットファイル (pas) は同じ名前であってはいけません。Lazarus はユニットの名前(ソースコードに現れる名前)をユニットファイル名(xxxの部分)と同じになるように、またプログラムの名前をプロジェクトファイル名(yyyの部分)と同じになるように設定するので、同じになっていると、プロジェクト中で識別子が重複してしまいます。
 +
一貫性を維持するため、project1 や、unit1 に適当な名前をつけましょう。
  
こういったわけで、'''again''' という名前のプロジェクトを保存しようとする際に、again.pas と again.lpr という名前で保存しようとするとうまくいきません。ユニット名とプログラム名は同じ名前空間にあるため、名前の重複というエラー duplicate name error を引き起こすからです。
+
たとえば、'''again''' という名前のプロジェクトを保存しようとする際に、again.pas と again.lpr という名前で保存しようとするとうまくいきません。ユニット名とプログラム名は同じプロジェクト中にあるため、名前が重複したというエラー duplicate name error になります。
  
 
そこで、次のようになりました:
 
そこで、次のようになりました:
Line 376: Line 223:
  
 
;'''again.exe:'''
 
;'''again.exe:'''
:メインプログラムのバイナリ実行ファイルです。Win32では拡張子"exe"がつきます。Linux(やMac OS X)では何もつきません。デバグ用のシンボルを含むために、Linuxでは巨大なファイルになります。"strip"コマンドでそれらを除去すると実行ファイルを小さくすることができます。
+
:メインプログラムのバイナリ実行ファイルです。Win32では拡張子"exe"がつきます。Linux(やMac OS X)では何もつきません。デバッグ用のシンボルを含むために、Linuxでは巨大なファイルになります。"strip"コマンドでそれらを除去すると実行ファイルを小さくすることができます。
  
 
;'''again.lpi:'''
 
;'''again.lpi:'''
:Lazarus プロジェクトのメインファイルです (Lazarus Project Information); Delphi でこれと等価なものが .dpr になるでしょう。このファイルは XML フォーマットで保存されます。
+
:Lazarus プロジェクトのメインファイルです (Lazarus Project Information); Delphi でこれと同等なものが .dpr です。このファイルは XML フォーマットで保存されます。
  
 
;'''again.lpr:'''
 
;'''again.lpr:'''
:メインプログラムのソースファイルです。Lazarus特有の拡張部分を除くと、実際にはごく普通の Pascal ソースファイルです。uses節があり、コンパイラはその記述に従って必要な全ユニットを見つけます。Program 宣言の名前はファイル名と一致する必要がないことにご留意ください。
+
:メインプログラムのソースファイルです。Lazarus特有の拡張部分を除くと、実際にはごく普通の Pascal ソースファイルです。
 +
uses節があり、コンパイラはその記述に従って必要な全ユニットを見つけます。Program 宣言の名前はファイル名と一致する必要があります。
  
 
;'''againu.lfm:'''
 
;'''againu.lfm:'''
Line 438: Line 286:
 
* Some corrections to ConsoleModePascal. 21 July 2004 [[User:Kirkpatc]]
 
* Some corrections to ConsoleModePascal. 21 July 2004 [[User:Kirkpatc]]
 
* Some small changes to ComponentPalette. 22 July 2004 [[User:Kirkpatc]]
 
* Some small changes to ComponentPalette. 22 July 2004 [[User:Kirkpatc]]
 +
* Some edits and additions to the Lazarus Component section. 23th Jan 2009 [[User: Miyatake]]

Latest revision as of 00:19, 31 March 2024

Deutsch (de) English (en) español (es) suomi (fi) français (fr) magyar (hu) italiano (it) 日本語 (ja) македонски (mk) Nederlands (nl) português (pt) русский (ru) slovenčina (sk) shqip (sq) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

日本語版メニュー
メインページ - Lazarus Documentation日本語版 - 翻訳ノート - 日本語障害情報

このLazarusチュートリアルに、遠慮なくあなたの経験を書き加えてみませんか? どうぞご遠慮なく。

概要

Lazarusは Free Pascal コンパイラのためのフリーでオープンソースな開発ツールです。 Lazarus IDEは、機能が豊富なプログラム環境であり、単独で機能するGUIアプリケーションやコンソールアプリケーションを開発できます。 Lazarusは、現在 Linux、 FreeBSD、 Win32 そして Mac OS X の上で動作し、カスタマイズ可能なソースエディタ、FreePascalコンパイラと統合された完全なGUI、 パッケージマネージャやデバッガを持つビジュアルなフォーム作成環境を提供します。

スクリーンショット

Lazarusでプログラムをはじめてみよう

Lazarusをインストールして、起動してみてください。これだけで、Free PascalやLazarusをつかったプログラムをはじめてみることができます。

起動すると、いくつかのウィンドウがデスクトップ上に現れます。上の方にはメインメニューがあります。左には、オブジェクトインスペクタあります。そのほかのデスクトップの大部分は、ソースコードエディタです。多分Form1ウィンドウが作られていて、ソースエディタに重なっているはずです。

上の方にあるメニューウィンドウの、メニューの下にタブの列があります。'標準'タブが選択されていますね。そこでButtonアイコン(四角の中に「OK」と書いてあるもの)を探してクリックしてください。そして、Form1の上の左中央あたりでクリックしてください。すると'Button1'と書かれた四角い図形(=ボタンです)が現れるはずです。もう一回標準タブのButtonアイコンをクリックして、Form1の右中央でクリックしてください。'Button2'と書かれたボタンが現れます。

Button1をクリックしましょう。オブジェクトインスペクタに、オブジェクトButton1のプロパティが表示されます。'Caption'と名付けられたプロパティに'Button1'と表示されていますね。その部分をクリックして'Button1'を'Press'に書き換えてください。あなたがENTERキーを押すか、別のボックスをクリックすれば、最初にForm1に置いたボタンが'Press'という名前になります。 続いて、オブジェクトインスペクタ上のイベントタブをクリックすると、ボタンに関連付けられている色々なイベントを見ることができます。 イベントには、たとえば、OnClick、OnEnter、OnExitなどがあります。OnClickボックスの右側を選択してください。小さなボックスが...と一緒に表示されます。あなたがこれをクリックすれば、自動的にソースエディタに移動してカーソルはコードの開始部分に移動します。

  procedure TForm1.Button1Click(Sender: TObject);
  begin
    {ここで次のように入力:}    Button1.caption := 'Press again';
    {エディタは、このプロシージャ名を補完しました。}
  end;

と入力したら、F12を押してソースエディタから出てForm1ウィンドウを選択してください。

続いてButton2のプロパティを編集します。Button2をクリックして、プロパティをオブジェクトインスペクタに表示させてください。Captionプロパティを変更して'Button2'から'Exit'にします。イベントタブを選択して、OnClickボックスをクリックしてください。...をクリックして、ソースエディタに入り、真ん中あたりのプロシージャに

  procedure TForm1.Button2Click(Sender: TObject);
  begin
    {ここで次のように入力:}   Close;
    {エディタは、このプロシージャ名を補完しました。}
  end;

こう書いて、もう一度F12を押してForm1ウィンドウに戻ります。 これで、コンパイルを試みる段階まで来ました。コンパイルはとても簡単です。メインメニューにある'実行'を選択するだけです。 サブメニューで'実行'のオプションを選ぶこともできます。 また、単純にF9を押しても行えます。最初のコンパイルが行われ(うまくいけば)、リンクが完了し、コンパイルされたプログラムが実行されます。

複数のテキストウィンドウが現れてすべてのコンパイラメッセージが表示され、その後はForm1ウィンドウが現れますが、グリッドの点は表示されません。これはあなたのアプリケーションのメインウィンドウであり、あなたがボタンを押すか他の方法で操作をするのを待っています。

では'Press'と書かれたボタンを押してみましょう。あなたはそれが'Press again'と変わることに気づくでしょう。あなたがそれをもう一度押してもそれは'Press again'でしょう!!

'Exit'のボタンも押してみます。ウィンドウが閉じてプログラムが終了します。オリジナルのForm1ウィンドウがドットによるグリッドとともに表示され、編集可能な状態になります。

それではこれまでの作業を保存しておきましょう(これは頻繁に行いましょうね!!)。プロジェクトメニュー > 別名で保存 > your_selected_file_name.pas(適当な名前を付けます)とすれば完了です。これで、プログラムを終了して、PCの電源を切っても、保存したところから作業を再開できます。

プログラムを変更する

先ほど保存しておいた、プロジェクトを開いてください。 Form1ウィンドウにある'Press'ボタンをクリックして、選択してください。 オブジェクトインスペクタのイベントタブを選択して、OnClickボックスの右側をクリックして、ソースエディタの適切な位置に戻りましょう。

次に続くコードを参考に、さきほどのコードを書き直してみてください。

  procedure TForm1.Button1Click(Sender: TObject);
 {TButtonのTagプロパティを使います。ここでは0か1の値を設定しています。}
  begin
    if Button1.tag =0 then
    begin
      Button1.caption := 'Press again';
      Button1.tag := 1
    end else
    begin
      Button1.caption := 'Press';
      Button1.tag := 0
    end
  end;

保存し、もう一度コンパイルして実行しましょう。このコードによって、左側のボタンを押すと、今度はふたつのメッセージを交互に表示するようになりました。

さあ、後は自由に工夫してみてください。

もし、このようなGUIをもつプログラムでなく、たとえばあなたが基本的なPascalプログラミングを試してみたい、とかバッチモードで動作するプログラムを書く必要がある、とかシステムプログラミングをしたいとかそういう時には、コンソールやテキストベースのPascalプログラムを書く場面があるかもしれません。

そんな時にも、プログラムを編集、コンパイル、実行するために、Pascalの統合開発環境としてLazarusを使うことができます。 LazarusはPascalによる開発のための理想的な環境を作ります。詳しくはコンソールモードPascalをご覧ください。

エディタのウインドウ

Lazarusを起動すると、いくつかに分割されている'フローティング'ウィンドウが、あなたのデスクトップ上に現れます。

デスクトップ右上に、Lazarus Editor vXXXXXX - project1(これはあなたが現在開いているプロジェクトの名前になります)とタイトルに書かれたものが表示されています。

これがプロジェクトのメインコントロールウィンドウで、メインメニューとコンポーネントパレットを含んでいます。


LazMain ja.png


タイトルバー下のラインはメインメニューでファイル、編集、検索、表示メニューなどを含んでおり、Lazarusの基本的な操作をおこなえます。

この下に一組のビットボタン(よく使うメニューアイテムへのショートカットになっています)があり、その右側にはコンポートネントパレットがあります。

Lazarus Editorウィンドウの下にはオブジェクトインスペクタが左側に、 ソースコードエディタが右側にあります。他に小さな窓があり、Form1と名付けられていてLazarusソースエディタウィンドウの上に覆いかぶさっているでしょう。これが見えなければF12キーを押すことですぐに画面上に復帰させることができます。 Formウィンドウはあなたのアプリケーションのグラフィカルインターフェイスを作成するためにあり、ソースエディタはあなたのアプリケーションのPascalコードを表示します。The operation of the Object Inspector is discussed in more detail below while the Component Palette is described.

あなたが新しいプロジェクトを始めるとき、(Lazarusもしくはあなたが最初にLazarusを起動するとき)デフォルトのフォームが既に作成されていることでしょう。ここにはドットでグリッドが描かれており、あなたがコンポーネントをフォームに配置するときの手助けをします。そしてタイトルバーには最小化最大化 そして 閉じるのボタンがあります。もし あなたがこのウィンドウをクリックすればデスクトップの左側にあるオブジェクトインスペクタにこのフォームのプロパティが表示されます。

他のウィンドウが貴方の作業中に目にはいるようになることもあるでしょう。 プロジェクトインスペクタはあなたのプロジェクトの詳細と、関連するファイルを表示し、またファイルの追加や削除を行うことができます。メッセージウィンドウ は貴方のプロジェクトに関するコンパイラからのメッセージやエラー、もしくは進行状態を表示します。もしもLazarusをターミナルウィンドウから起動しているなら、本来ターミナルに表示されるべきことがらや、コンパイラメッセージの詳細が出力されます。

メインメニュー

Lazarus IDEのメインメニューからアクセスできるすべてのメニューアイテムの詳細な説明については、Main menu/jaページを参照してください。

IDE クールバー

ide coolbar.png

メインコントロールウィンドウの左側、メインメニューの直下、コンポーネントパレットの左にIDEクールバーがあります。ここには、メインメニューの中でよく用いられる機能のボタンがあります:

新規ユニット開く (ボタン右側の下向き矢印を押すと最近扱ったファイルの一覧が表示されます)、保存すべて保存新規フォームフォーム/ユニット切り替え(フォームかユニットのソースコードを表示)、ユニットを表示フォームを表示実行(コンパイルして実行)、一時停止トレース実行ステップ実行(最後の2つはデバッガの機能)

コンポーネントパレット

コンポーネントパレットとは、多くのアイコンが並んだタブ付きのツールバーのことです。各アイコンは、フォームを作成する際によく用いられるコンポーネントを表しています。

size="100%

Component Palette/ja
Standard - Additional - Common Controls - Dialogs - Data Controls - Data Access - System - Misc - LazControls - RTTI - SQLdb - Pascal Script - SynEdit - Chart - IPro

それぞれのタブは機能ごとに分けられており、異なった組のアイコンからなります。 全てのタブでは、一番左に矢印のアイコンがあります。これは選択ツール(Selection Tool)と呼びます。

マウスカーソルをコンポーネントパレットのアイコンの上に移動して、しばらくクリックしないで待つと、アイコンが意味するコンポーネントの名前がポップアップします。 それらの名前がすべて 'T' で始まることに注意してください。これは、そのコンポーネントの 「型:'Type'」 、正確に言うとコンポーネントの 「クラス:'Class'」 を示しています。

コンポーネントをフォームに加えると、その ClassUnitInterface 部の Type セクションに追加されます。(通常は TForm1 の定義の一部として) 同時に、そのクラスの instanceVar セクションに加えられます(通常、Form1という名前の変数として)。 フォームやコンポーネントが用いる Methods は、全て(つまり全ての ProcedureFunction )、そのユニットの Implementation 部で宣言する必要があります。

コンポーネントのサンプルプログラム

コンポーネントのサンプルプログラムは、 $LazarusPath/lazarus/examples に保存されています。

多くのプログラムで、IDEやコンポーネントパレットを使わないでダイアログや他のコンポーネントを利用する方法が分かるでしょう。全てのコンポーネントは、明確に主となるpascalプログラムで定義されています。 IDEを大いに利用するサンプルもあります。

サンプルプログラムの中には、そのままでは動作しないものもあるでしょう。ファイルやディレクトリのパス、パーミッションを設定する必要があるかも知れません。サンプルプログラムをコンパイルするにあたり、ファイル及びディレクトリに対する 読み/書き/実行 (read/write/execute) のパーミッションを確認して下さい。または適切なパーミッションを持ったディレクトリにファイルをコピーしてください。

まずは、'testall' プログラムを実行してみましょう。利用可能なコンポーネントのメニューと簡単な実行例があります。コードを読んでどう動いているか調べてみましょう!

コンポーネントの一覧

コンポーネントの一覧を以下に示します。各ユニットには、それらの解説するページへのリンクが張ってあります(ないのもあります)。 あるコンポーネントのプロパティについて知りたければ、そのコンポーネントの継承を調べ、継承元となるコンポーネントについて調べるとよいでしょう。 例えば、TMaskEdit について理解することは、 TCustomMaskEditについて調査する際にも役に立ちます。

タブの名前 (タブ自体の名前がおよその説明になっています。)

Component Palette Standart.png
TMainMenu, TPopupMenu, TButton, TLabel, TEdit, TMemo, TToggleBox, TCheckBox, TRadioButton, TListBox, TComboBox, TScrollBar, TGroupBox,TRadioGroup, TCheckGroup, TPanel, TActionList
Component Palette Additional.png
TBitBtn, TSpeedButton, TStaticText, TImage, TShape, TBevel, TPaintBox, TNotebook, TLabeledEdit, TSplitter, TTrayIcon, TMaskEdit, TCheckListBox, TScrollBox, TApplicationProperties, TStringGrid, TDrawGrid, TPairSplitter, TColorBox, TColorListBox, TChart
Component Palette Common Controls.png
TTrackBar, TProgressBar, TTreeView, TListView, TStatusBar, TToolBar, TUpDown, TPageControl, TTabControl, THeaderControl, TImageList, TPopupNotifier
Component Palette Dialogs.png
TOpenDialog, TSaveDialog, TSelectDirectoryDialog, TColorDialog, TFontDialog, TFindDialog, TReplaceDialog, TOpenPictureDialog, TSavePictureDialog, TCalendarDialog, TCalculatorDialog, TPrinterSetupDialog, TPrintDialog, TPageSetupDialog

パレットに含まれていませんが、他にもいくつかの便利な ダイアログ手続きや関数があります。それらはソースプログラムから直接に呼び出せ、簡単に利用できます。


  • Misc(その他)
Component Palette Misc.png
TColorButton, TSpinEdit, TFloatSpinEdit, TArrow, TCalendar, TEditButton, TFileNameEdit, TDirectoryEdit, TDateEdit, TCalcEdit, TFileListBox, TXMLPropStorage, TIniPropStorage, TBarChart, TButtonPanel, TIDEDialogLayoutStorage
  • Data Controls(データの制御。Standard及びAdditionalグループに似ていますが、データベースに適用できます)
Component Palette DataControls.png
TDBNavigator, TDBText, TDBEdit, TDBMemo, TDBImage, TDBListBox, TDBComboBox, TDBCheckBox, TDBRadioGroup, TDBCalendar, TDBGroupBox, TDBGrid
  • Data Access(データへのアクセス)
Component Palette DataAccess.png
TDatasource, TMemDataset, TSdfDataSet, TFixedFormatDataSet, TDbf
  • System(システム)
Component Palette System.png
TTimer, TIdleTimer, TLazComponentQueue, THtmlHelpDatabase, THtmlBrowserHelpViewer, TProcessUTF8, TAsyncProcess, TProcess, TSimpleIPCClient, TSimpleIPCServer, TXMLConfig, TEventLog
  • SynEdit(SynEdit:他の言語や開発ツールへのインターフェースとなるコンポーネントsourceforge
Component Palette SynEdit.png
TSynEdit, TSynAutoComplete, TSynExporterHTML, TSynMacroRecorder, TSynMemo, TSynPasSyn, TSynFreePascalSyn, TSynCppSyn, TSynJavaSyn, TSynPerlSyn, TSynHTMLSyn, TSynXMLSyn, TSynLFMSyn, TSynUNIXShellScriptSyn, TSynCssSyn, TSynPHPSyn, TSynTeXSyn, TSynSQLSyn, TSynPythonSyn, TSynVBSyn, TSynAnySyn, TSynMultiSyn

SynEditは、 Borland Delphi, Kylix と C++Builder用の複数行編集コントロールであり、文法ハイライト機能やコード補完機能、HTMLやTeX、RTFへのエクスポート機能を持っています。これは完全なVCL/CLXコントロールであり、Microsoft Windows のコントロールのラッパーではなく、ランタイムライブラリを必要としない、クロスプラットフォームで利用できるコンポーネントです。FreePascalとの互換性も計画されており、 Lararus IDE をエディタも SynEditが利用されています。sourceforgeも参照ください。

コンポーネントパレットの使い方

コンポーネントパレットの利用にあたっては、フォームが作成されており、エディタ上で見えている必要があります(フォームが無い場合は、 File -> New Form で新たなフォームが作成してください)。 次に、使いたいコンポーネントのアイコンをクリックして選択し、フォーム上のコンポーネントを配置したい位置でクリックすることで、選択されたコンポーネントが配置されます。 コンポーネントの移動やサイズの調整は、マウスで直接操作することでもできますし、コンポーネントのプロパティの値をオブジェクトエディタから直接操作することでもできます。

コンポーネントを新たに追加したときには(自作や他のパッケージから追加するなど)、コンポーネントパレットに新しいタブが現れ、コンポーネントに応じたアイコンが表示されます。それらは他のコンポーネントと同様に使用できます。

デバッガ

(まだ書かれていません)

Lazarusのファイルについて

ファイルの保存操作をすると、次の二つのファイルを保存することになります:

  xxx.pas
  yyy.lpr 

他にも保存されるファイルはありますが、あなたが名前をつけられるのはこの二つです。 プロジェクトファイル (lpr) 及びユニットファイル (pas) は同じ名前であってはいけません。Lazarus はユニットの名前(ソースコードに現れる名前)をユニットファイル名(xxxの部分)と同じになるように、またプログラムの名前をプロジェクトファイル名(yyyの部分)と同じになるように設定するので、同じになっていると、プロジェクト中で識別子が重複してしまいます。 一貫性を維持するため、project1 や、unit1 に適当な名前をつけましょう。

たとえば、again という名前のプロジェクトを保存しようとする際に、again.pas と again.lpr という名前で保存しようとするとうまくいきません。ユニット名とプログラム名は同じプロジェクト中にあるため、名前が重複したというエラー duplicate name error になります。

そこで、次のようになりました:

e:/lazarus/kj/lazhello:

total 4740  free 76500
-rwxrwxrwx   1 kjwh     root  4618697 Mar 24 11:19 again.exe
-rw-rw-rw-   1 kjwh     root     3002 Mar 24 11:21 again.lpi
-rw-rw-rw-   1 kjwh     root      190 Mar 24 11:18 again.lpr
-rw-rw-rw-   1 kjwh     root      506 Mar 24 11:08 againu.lfm
-rw-rw-rw-   1 kjwh     root      679 Mar 24 11:08 againu.lrs
-rw-rw-rw-   1 kjwh     root      677 Mar 24 11:08 againu.pas
-rw-rw-rw-   1 kjwh     root     2124 Mar 24 11:08 againu.ppu
-rwxrwxrwx   1 kjwh     root      335 Mar 24 11:07 ppas.bat

二つのファイル (again.lpr、againu.pas) を保存したと思っていたのに、もっと多くのファイルが保存されています。

それぞれのファイルの簡単な説明をしておきましょう:

again.exe:
メインプログラムのバイナリ実行ファイルです。Win32では拡張子"exe"がつきます。Linux(やMac OS X)では何もつきません。デバッグ用のシンボルを含むために、Linuxでは巨大なファイルになります。"strip"コマンドでそれらを除去すると実行ファイルを小さくすることができます。
again.lpi:
Lazarus プロジェクトのメインファイルです (Lazarus Project Information); Delphi でこれと同等なものが .dpr です。このファイルは XML フォーマットで保存されます。
again.lpr:
メインプログラムのソースファイルです。Lazarus特有の拡張部分を除くと、実際にはごく普通の Pascal ソースファイルです。

uses節があり、コンパイラはその記述に従って必要な全ユニットを見つけます。Program 宣言の名前はファイル名と一致する必要があります。

againu.lfm:
フォームユニットのレイアウトを格納します。Lazarus はこれを用いてリソースファイルを生成し、それが againu.pas の初期化セクション でインクルードされます。 Lazarus IDE の Tools->Convert DFM file to LFM utility を用いると、Delphi の dfm ファイルをlfmに変換することができます。
againu.lrs:
生成されたリソースファイルです。Windows のリソースファイルとは異なります。
againu.pas:
このユニットにフォームのコードを書きます。
againu.ppu:
ユニットをコンパイルしたオブジェクトコードです。
ppas.bat:
プログラムをリンクし実行ファイルを作るための簡単なスクリプト(バッチファイル)です。コンパイルが成功すれば、コンパイラによって削除されます。

Original contributors and changes

This page has been imported from the epikwiki version.

  • Created initial page and template. T. Lisjac - 11/04/2003 VlxAdmin
  • 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
  • Per above, moved Chris's writeup to the main body of the tutorial VlxAdmin
  • Began to insert text describing the Lazarus Editor - more to follow! 24 Mar 2004 User:Kirkpatc
  • Added some more to Lazarus Editor section of Tutorial. 25 Mar 2004 User:Kirkpatc
  • Added screenshots and revised some of the page formatting VlxAdmin 3/25/2004
  • 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
  • Formatted, added credits and comments. Removed original notes. VlxAdmin 3/26/2004
  • More material added to Editor section of tutorial. 26 Mar 2004 User:Kirkpatc
  • 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
  • Inserted section on Run sub-menu. Some general editing (eg ended each entry with a period to ensure consistency). 9 Apr 2004 User:Kirkpatc
  • Inserted a new section on How to get started with MySQL in FPC/Lazarus. 13 Apr 2004 User:Kirkpatc
  • Deleted the section on MySQL from here: it has been copied to Lazarus Database section of tutorial. 14 Apr 2004 User:Kirkpatc
  • Added some more to the description of the Editor Main Menu. 18 Apr 2004 User:Kirkpatc
  • Added section on Environment sub-menu. 19 Apr 2004 User:Kirkpatc
  • Added section on Components sub-menu. 4 May 2004 User:Kirkpatc
  • Adding Tools sub-menu description (incomplete). 7 May 2004 User:Kirkpatc
  • Added some screenshots to Menu descriptions. 9 May 2004 User:Kirkpatc
  • Fixed a bit in Environment Options - thanks VincentSnijders. 14 May 2004 User:Kirkpatc
  • More additions to Tools sub-menu. 19 May 2004 User:Kirkpatc
  • Added a section on the Button Bar and started work on The Component Palette. 20 May 2004 User:Kirkpatc
  • Posted a description file for the StdCtrls unit of the LCL, in the hope that people will add comments. 26 May 2004 User:Kirkpatc
  • 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
  • Expanding on the Components Palette. 5 June 2004 User:Kirkpatc
  • Added a lot to the DialogExamples page. 10 June 2004 User:Kirkpatc
  • 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
  • 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
  • Added page for Common Controls (linked to Component Palette). 16 June 2004 User:Kirkpatc
  • Added MaskEdit page (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Added Buttons, ExtCtrls pages (linked to Component Palette). 17 June 2004 User:Kirkpatc
  • Edited MainMenu component description page. 23 June 2004 User:Kirkpatc
  • Some additions to Common Controls. 28 June 2004 User:Kirkpatc
  • A new tutorial on Text-mode Pascal programming has been added. 5 July 2004 User:Kirkpatc
  • Minor changes to ComCtrls, ExtCtrls, Environment Menu. 10 July User:Kirkpatc
  • Added FormsTxt, component description page for Component Palette. 20 July 2004 User:Kirkpatc
  • Some corrections to ConsoleModePascal. 21 July 2004 User:Kirkpatc
  • Some small changes to ComponentPalette. 22 July 2004 User:Kirkpatc
  • Some edits and additions to the Lazarus Component section. 23th Jan 2009 User: Miyatake