Difference between revisions of "TEdit/ja"

From Free Pascal wiki
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
==使い方==
 
==使い方==
  
You can add a TEdit text input field to your [[TForm|form]] by clicking on it in the Standard tab of the component palette and place it on your form with one click. You can now edit this single-line text field at run time.
+
TEditはコンポーネントパレットの[[Standard tab/ja|Standardタブ]]にあるTEditアイコンをクリックし、フォーム[[TForm|form]]上で1回クリックすることで加えることができる。これで、実行時にこの1行テキストフィールドを編集できる。
  
If you want to use this text elsewhere, you can use it like every other [[String]].
+
もし、このテキストを別の場所で使いたいときは、他の[[String]]のように用いることができる。
  
For example, if you have a TEdit ''Edit1'' on your form, you can use <code>myString := Edit1.Text;</code>. To change the shown text in ''Edit1'', you can use <code>Edit1.Text := myString;</code>.
+
例えば、もしTEdit ''Edit1''をフォームに加えると、<code>myString := Edit1.Text;</code>を用いることができる。
  
If you want to display another text instead of the default text (e.g. ''Edit1'') in a TEdit ''Edit1'' at the start of your application, you can proceed as follows:
+
もし、アプリケーションの起動時TEdit ''Edit1''の中のデフォルトテキスト(例えば、''Edit1'')をほかのものを表示するようにしたいなら、以下のように進めることができる:
 
+
* フォーム上のTEditをクリックによって選択する。
* Select the TEdit on your form with one click.
+
* オブジェクトインスペクタのプロパティタブに移動する。
* Go to the properties tab in the Object Inspector.
+
* プロパティ'''Text'''を選択し、隣の入力フィールドを変更する。
* Select the property '''Text''' and change it in the neighbouring input field.
+
* 同様にして、プロパティ'''Name'''を選択し、TEditをましな名前にする。
* In the same way, you can select the property '''Name''' and give the TEdit a better name.
 
  
 
===パスワード入力===
 
===パスワード入力===
  
You can also easily use a TEdit to enter passwords. Then instead of the actually entered [[Char]] a PasswordChar is displayed.
+
TEditを簡単にパスワードを入力に用いることができる。このようにして、実際に入力した[[Char]]に代わり、パスワード文字を表示させる。
  
Little Example:
+
簡単な例:
  
* Create a new GUI application with a TEdit ''Edit1'' and a TButton ''Button1'' on the form.
+
* 新しいTEdit TEdit ''Edit1''を持つGUIアプリケーションを作り、TButton ''Button1''をフォームに置く。
* In the Object Inspector set the property PasswordChar of ''Edit1'' to am asterisk ( * ).
+
* オブジェクトインスペクタで''Edit1''のパスワード文字プロパティを、1つのアスタリスク( * )にする。
* In the event handler of ''OnClick'' of ''Button1'' show the entered password: <code>ShowMessage(Edit1.Text);</code>.
+
* ''Button1''''OnClick''イベントハンドラは入力されたパスワードを: <code>ShowMessage(Edit1.Text);</code>と示す。
  
 
===テキストヒント===
 
===テキストヒント===
  
Have you used a GUI that has, for example, a Search Box where you can type in a search term. And when unused, that Search Box displays something like "Search Here" so you know what it is for ? Well, TEdit has a property called TextHint for that purpose. Set TextHint to some appropriate text and if the normal 'Text' is empty and the Control is not in use, your Search Here message is displayed. On most Widget Sets, the TextHint is automatically cleared once the user starts typing in there. The exception is GTK2/3, they like to clear things as soon as the Control gets focus.
+
例えば、検索語を入力できる検索ボックスに入力したことはあるだろうか。そして使われてないときは、検索語ボックスはそれが何のためにあるか知らせるために「検索」のようなものを表示しているのを見たことはあるだろうか。そう、TEditはこの目的のためにTextHintと呼ばれるプロパティを持っている。TextHintは通常の「Text」が空でコントロールが使用されていない場合は、「検索」メッセージが表示される。たいていの部品ではTextHintはユーザーがタイプを始めると自動的にそこから消える。この例外はGTK2/3で、コントロールがフォーカスを得ると直ちに、中身を消し去る。
  
The text from TextHint is displays a little greyer than normal text so the user is aware it is somehow special. Most people find this interface quite intuitive.
+
TextHintからのテキストは通常のテキストより、幾分灰色がかっており、そのためユーザーは何か特別なものと気づく。大方の人はこのインタフェースを直感的に理解する。
  
 
==要望事項==
 
==要望事項==
  
===TEditの埋め込まれたボタン/他のコントロール in TEdit===
+
===TEditの埋め込まれたボタン/他のコントロール===
  
It's a WinAPI feature to allow embedding any sort of control into a TEdit.
+
あらゆる種類のコントロールをTEditに埋め込むことができるのはWinAPIの特性である。
  
Considerations.
+
考慮事項
  
* The feature is not supported by all Widgetsets natively.  For example: for Gtk2/Gtk3 it's not possible, as GtkEntry is not derived from a container. The SpinEdit control is a special kind of control in Gtk2. (This is the main reason on why [[TSpinEdit]] has its own WS class).
+
* この特性はすべての部品で本来サポートされていない。例えば、GtkEntryがコンテナに由来しないのでGtk2/Gtk3では不可能である。SpinEditコントロールはGtk2の中で特別なクラスである(これは[[TSpinEdit]]がそれ自身のWSクラスを持つ主たる理由である)
  
* The placement of an embedded control (or controls) cannot be set by Left or Top properties (as normally happens). Instead the "Align" property should be used.
+
* 埋め込まれたコントロールの配置に左、あるいは上方プロパティを設定することはできない(これは通常発生する)。そのかわり、「整列(Align)」プロパティを使うべきである。
  
 
<syntaxhighlight lang="delphi">
 
<syntaxhighlight lang="delphi">
Line 55: Line 54:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* The "text" entry field must be limited by some TEdit property
+
* 「Text」エントリフィールドはTEditプログラムによって制限される:もしくは部品によって自動的に行われるべきである
:OR this should be done automatically by the widgetset.
 
  
Without such a limitation, the entered text goes "underneath" the embedded button.
+
このような制限ないと、入力されたテキストはボタンの「下側」に行ってしまう。
  
 
[[Image:edit1.gif]]
 
[[Image:edit1.gif]]
  
If using pure WinAPI, this can be achieved by using an EM_SETMARGINS message:
+
もし純粋なWinAPIを用いると、これは EM_SETMARGINS メッセージを使用することで行われる:
  
 
<syntaxhighlight lang="delphi">
 
<syntaxhighlight lang="delphi">
Line 75: Line 73:
 
[[Image:edit2.gif]]
 
[[Image:edit2.gif]]
  
The Delphi VCL does provide a Margins property, but it is not mapped to EM_SETMARGINS and has a different meaning in the VCL.
+
DelphiVCLはMarginsプロパティを提供するが、これは EM_SETMARGINS にはマップされず、VCLで異なる意味を持つ。
  
 
==以下も参照のこと==
 
==以下も参照のこと==
 
* [[doc:lcl/stdctrls/tedit.html|TEdit doc]]
 
* [[doc:lcl/stdctrls/tedit.html|TEdit doc]]
* [[TMemo]] - A multiline text edit box
+
* [[TMemo]] - 複数行のテキスト編集ボックス
* [[TLabeledEdit]] - An edit field like a TEdit with a label
+
* [[TLabeledEdit]] - TEditにラベルがついた編集フィールド
* [[TMaskEdit]] - An edit field with an edit mask
+
* [[TMaskEdit]] - マスクのついた編集フィールド
* [[TSpinEdit]] - An edit field for integers defined numbers range limits
+
* [[TSpinEdit]] - 長さが制限された整数のための編集フィールド
* [[TFloatSpinEdit]] - An edit field for tiles floating-point numbers with defined numbers range limits
+
* [[TFloatSpinEdit]] - 長さが制限された浮動小数点タイルのための編集フィールド
* [[TEditButton]] - An edit field like a TEdit with an attached button as a [[TSpeedBtn]]
+
* [[TEditButton]] - [[TSpeedBtn]]をボタンとして持つTEditにような編集フィールド
* [[TFileNameEdit]] - An edit field with attached [[TOpenDialog]], to enter a file name
+
* [[TFileNameEdit]] - ファイル名を入力するために[[TOpenDialog]]がつけられた編集フィールド
* [[TDirectoryEdit]] - An edit field with attached [[TSelectDirectoryDialog]], to enter a file path
+
* [[TDirectoryEdit]] - ファイルパスを入力するために[[TSelectDirectoryDialog]]がつけられた編集フィールド
* [[TDateEdit]] - An edit field with attached [[TCalendarDialog]] (calendar), to enter a date
+
* [[TDateEdit]] - 日付を入力するために[[TCalendarDialog]](カレンダー)につけられた編集フィールド
* [[TCalcEdit]] - An input field with attached [[TCalculatorDialog]] (Calculator), to enter a number
+
* [[TCalcEdit]] - 数字を入力するために[[TCalculatorDialog]] (電卓)につけられた入力フィールド
* [[TTIEdit]] - An RTTI capable input field
+
* [[TTIEdit]] - RTTI可能な入力フィールド
  
{{LCL Components}}
+
{{LCL Components/ja}}

Latest revision as of 06:48, 20 March 2024

Deutsch (de) English (en) suomi (fi) français (fr) 日本語 (ja) русский (ru)

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

TEdit tedit.pngは1行編集のコントロールである。コンポーネントパレットStandardタブにある。

使い方

TEditはコンポーネントパレットのStandardタブにあるTEditアイコンをクリックし、フォームform上で1回クリックすることで加えることができる。これで、実行時にこの1行テキストフィールドを編集できる。

もし、このテキストを別の場所で使いたいときは、他のStringのように用いることができる。

例えば、もしTEdit Edit1をフォームに加えると、myString := Edit1.Text;を用いることができる。

もし、アプリケーションの起動時TEdit Edit1の中のデフォルトテキスト(例えば、Edit1)をほかのものを表示するようにしたいなら、以下のように進めることができる:

  • フォーム上のTEditをクリックによって選択する。
  • オブジェクトインスペクタのプロパティタブに移動する。
  • プロパティTextを選択し、隣の入力フィールドを変更する。
  • 同様にして、プロパティNameを選択し、TEditをましな名前にする。

パスワード入力

TEditを簡単にパスワードを入力に用いることができる。このようにして、実際に入力したCharに代わり、パスワード文字を表示させる。

簡単な例:

  • 新しいTEdit TEdit Edit1を持つGUIアプリケーションを作り、TButton Button1をフォームに置く。
  • オブジェクトインスペクタでEdit1のパスワード文字プロパティを、1つのアスタリスク( * )にする。
  • Button1OnClickイベントハンドラは入力されたパスワードを: ShowMessage(Edit1.Text);と示す。

テキストヒント

例えば、検索語を入力できる検索ボックスに入力したことはあるだろうか。そして使われてないときは、検索語ボックスはそれが何のためにあるか知らせるために「検索」のようなものを表示しているのを見たことはあるだろうか。そう、TEditはこの目的のためにTextHintと呼ばれるプロパティを持っている。TextHintは通常の「Text」が空でコントロールが使用されていない場合は、「検索」メッセージが表示される。たいていの部品ではTextHintはユーザーがタイプを始めると自動的にそこから消える。この例外はGTK2/3で、コントロールがフォーカスを得ると直ちに、中身を消し去る。

TextHintからのテキストは通常のテキストより、幾分灰色がかっており、そのためユーザーは何か特別なものと気づく。大方の人はこのインタフェースを直感的に理解する。

要望事項

TEditの埋め込まれたボタン/他のコントロール

あらゆる種類のコントロールをTEditに埋め込むことができるのはWinAPIの特性である。

考慮事項

  • この特性はすべての部品で本来サポートされていない。例えば、GtkEntryがコンテナに由来しないのでGtk2/Gtk3では不可能である。SpinEditコントロールはGtk2の中で特別なクラスである(これはTSpinEditがそれ自身のWSクラスを持つ主たる理由である)。
  • 埋め込まれたコントロールの配置に左、あるいは上方プロパティを設定することはできない(これは通常発生する)。そのかわり、「整列(Align)」プロパティを使うべきである。
button1.Parent:=edit1;
button1.Width:=20;
button1.Align:=alRight;
button1.Constraints.MaxHeight:=18; //edit1.Height;
  • 「Text」エントリフィールドはTEditプログラムによって制限される:もしくは部品によって自動的に行われるべきである

このような制限ないと、入力されたテキストはボタンの「下側」に行ってしまう。

edit1.gif

もし純粋なWinAPIを用いると、これは EM_SETMARGINS メッセージを使用することで行われる:

Uses
  Windows, ...

...

  SendMessage(Edit1.Handle, EM_SETMARGINS, EC_LEFTMARGIN or EC_RIGHTMARGIN, MakeLParam(0, button1.Width))

edit2.gif

DelphiVCLはMarginsプロパティを提供するが、これは EM_SETMARGINS にはマップされず、VCLで異なる意味を持つ。

以下も参照のこと


LCL Components
Component Tab Components
Standard TMainMenu • TPopupMenu • TButton • TLabel • TEdit • TMemo • TToggleBox • TCheckBox • TRadioButton • TListBox • TComboBox • TScrollBar • TGroupBox • TRadioGroup • TCheckGroup • TPanel • TFrame • TActionList
Additional TBitBtn/ja • TSpeedButton/ja • TStaticText/ja • TImage/ja • TShape/ja • TBevel/ja • TPaintBox/ja • TNotebook/ja • TLabeledEdit/ja • TSplitter/ja • TTrayIcon/ja • TControlBar/ja • TFlowPanel/ja • TMaskEdit/ja • TCheckListBox/ja • TScrollBox/ja • TApplicationProperties/ja • TStringGrid/ja • TDrawGrid/ja • TPairSplitter/ja • TColorBox/ja • TColorListBox/ja • TValueListEditor/ja
Common Controls TTrackBar • TProgressBar • TTreeView • TListView • TStatusBar • TToolBar • TCoolBar • TUpDown • TPageControl • TTabControl • THeaderControl • TImageList • TPopupNotifier • TDateTimePicker
Dialogs TOpenDialog • TSaveDialog • TSelectDirectoryDialog • TColorDialog • TFontDialog • TFindDialog • TReplaceDialog • TTaskDialog • TOpenPictureDialog • TSavePictureDialog • TCalendarDialog • TCalculatorDialog • TPrinterSetupDialog • TPrintDialog • TPageSetupDialog
Data Controls TDBNavigator/ja • TDBText/ja • TDBEdit/ja • TDBMemo/ja • TDBImage/ja • TDBListBox/ja • TDBLookupListBox/ja • TDBComboBox/ja • TDBLookupComboBox/ja • TDBCheckBox/ja • TDBRadioGroup/ja • TDBCalendar/ja • TDBGroupBox/ja • TDBGrid/ja • TDBDateTimePicker/ja
Data Access TDataSource/ja • TCSVDataSet/ja • TSdfDataSet/ja • TBufDataset/ja • TFixedFormatDataSet/ja • TDbf/ja • TMemDataset/ja
System TTimer • TIdleTimer • TLazComponentQueue • THTMLHelpDatabase • THTMLBrowserHelpViewer • TAsyncProcess • TProcessUTF8 • TProcess • TSimpleIPCClient • TSimpleIPCServer • TXMLConfig • TEventLog • TServiceManager • TCHMHelpDatabase • TLHelpConnector
Misc TColorButton • TSpinEdit • TFloatSpinEdit • TArrow • TCalendar • TEditButton • TFileNameEdit • TDirectoryEdit • TDateEdit • TTimeEdit • TCalcEdit • TFileListBox • TFilterComboBox • TComboBoxEx • TCheckComboBox • TButtonPanel • TShellTreeView • TShellListView • TXMLPropStorage • TINIPropStorage • TJSONPropStorage • TIDEDialogLayoutStorage • TMRUManager • TStrHolder
LazControls TCheckBoxThemed • TDividerBevel • TExtendedNotebook • TListFilterEdit • TListViewFilterEdit • TLvlGraphControl • TShortPathEdit • TSpinEditEx • TFloatSpinEditEx • TTreeFilterEdit • TExtendedTabControl •
RTTI TTIEdit • TTIComboBox • TTIButton • TTICheckBox • TTILabel • TTIGroupBox • TTIRadioGroup • TTICheckGroup • TTICheckListBox • TTIListBox • TTIMemo • TTICalendar • TTIImage • TTIFloatSpinEdit • TTISpinEdit • TTITrackBar • TTIProgressBar • TTIMaskEdit • TTIColorButton • TMultiPropertyLink • TTIPropertyGrid • TTIGrid
SQLdb TSQLQuery/ja • TSQLTransaction/ja • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TMySQL57Connection • TSQLite3Connection/ja • TIBConnection • TFBAdmin • TFBEventMonitor • TSQLDBLibraryLoader
Pascal Script TPSScript • TPSScriptDebugger • TPSDllPlugin • TPSImport_Classes • TPSImport_DateUtils • TPSImport_ComObj • TPSImport_DB • TPSImport_Forms • TPSImport_Controls • TPSImport_StdCtrls • TPSCustomPlugin
SynEdit TSynEdit • TSynCompletion • TSynAutoComplete • TSynMacroRecorder • TSynExporterHTML • TSynPluginSyncroEdit • TSynPasSyn • TSynFreePascalSyn • TSynCppSyn • TSynJavaSyn • TSynPerlSyn • TSynHTMLSyn • TSynXMLSyn • TSynLFMSyn • TSynDiffSyn • TSynUNIXShellScriptSyn • TSynCssSyn • TSynPHPSyn • TSynTeXSyn • TSynSQLSyn • TSynPythonSyn • TSynVBSyn • TSynAnySyn • TSynMultiSyn • TSynBatSyn • TSynIniSyn • TSynPoSyn
Chart TChart • TListChartSource • TRandomChartSource • TUserDefinedChartSource • TCalculatedChartSource • TDbChartSource • TChartToolset • TChartAxisTransformations • TChartStyles • TChartLegendPanel • TChartNavScrollBar • TChartNavPanel • TIntervalChartSource • TDateTimeIntervalChartSource • TChartListBox • TChartExtentLink • TChartImageList
IPro TIpFileDataProvider • TIpHtmlDataProvider • TIpHttpDataProvider • TIpHtmlPanel
Virtual Controls TVirtualDrawTree • TVirtualStringTree • TVTHeaderPopupMenu