TEdit/ja

From Free Pascal wiki
Jump to navigationJump to search

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の埋め込まれたボタン/他のコントロール

It's a WinAPI feature to allow embedding any sort of control into a TEdit.

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).
  • 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.
button1.Parent:=edit1;
button1.Width:=20;
button1.Align:=alRight;
button1.Constraints.MaxHeight:=18; //edit1.Height;
  • The "text" entry field must be limited by some TEdit property
OR this should be done automatically by the widgetset.

Without such a limitation, the entered text goes "underneath" the embedded button.

edit1.gif

If using pure WinAPI, this can be achieved by using an EM_SETMARGINS message:

Uses
  Windows, ...

...

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

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.

以下も参照のこと


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 • TSpeedButton • TStaticText • TImage • TShape • TBevel • TPaintBox • TNotebook • TLabeledEdit • TSplitter • TTrayIcon • TControlBar • TFlowPanel • TMaskEdit • TCheckListBox • TScrollBox • TApplicationProperties • TStringGrid • TDrawGrid • TPairSplitter • TColorBox • TColorListBox • TValueListEditor
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 • TDBText • TDBEdit • TDBMemo • TDBImage • TDBListBox • TDBLookupListBox • TDBComboBox • TDBLookupComboBox • TDBCheckBox • TDBRadioGroup • TDBCalendar • TDBGroupBox • TDBGrid • TDBDateTimePicker
Data Access TDataSource • TCSVDataSet • TSdfDataSet • TBufDataset • TFixedFormatDataSet • TDbf • TMemDataset
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 • TSQLTransaction • TSQLScript • TSQLConnector • TMSSQLConnection • TSybaseConnection • TPQConnection • TPQTEventMonitor • TOracleConnection • TODBCConnection • TMySQL40Connection • TMySQL41Connection • TMySQL50Connection • TMySQL51Connection • TMySQL55Connection • TMySQL56Connection • TMySQL57Connection • TSQLite3Connection • 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