Difference between revisions of "TEdit"

From Lazarus wiki
Jump to navigationJump to search
m
Line 13: Line 13:
 
==Usage==
 
==Usage==
  
You can your [[TForm/de|Form]] a [[doc:lcl/stdctrls/tedit.html|TEdit]] input box add by clicking on it at the Standard component palette and place it on your form with one click. You can now edit this single-line text box at run time.
+
You can your [[TForm|Form]] a [[doc:lcl/stdctrls/tedit.html|TEdit]] input box add by clicking on it at the Standard component palette and place it on your form with one click. You can now edit this single-line text box at run time.
 
<br>
 
<br>
 
Want you this text elsewhere have, you can read this text, like every other [[String]].
 
Want you this text elsewhere have, you can read this text, like every other [[String]].
Line 35: Line 35:
 
* In the Object Inspector set the property PasswordChar of ''Edit1'' to a " * ".
 
* In the Object Inspector set the property PasswordChar of ''Edit1'' to a " * ".
 
* In the event handler of ''OnClick'' of ''Button1'' show the entered password: '''<code>ShowMessage(Edit1.Text);</code>'''
 
* In the event handler of ''OnClick'' of ''Button1'' show the entered password: '''<code>ShowMessage(Edit1.Text);</code>'''
 
  
 
==Special edit fields==
 
==Special edit fields==

Revision as of 22:24, 26 June 2014

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

>> LCL Components >> TEdit

This page explains how to use the TEdit component. When I mention to click on something, unless I explicitly say to right-click, you always left-click on the item in question.

Description

A control with a single line of editable text.

Comp Standard TEdit.png

Usage

You can your Form a TEdit input box add by clicking on it at the Standard component palette and place it on your form with one click. You can now edit this single-line text box at run time.
Want you this text elsewhere have, you can read this text, like every other String.
For example, you have a TEdit Edit1 on your form placed, you can use myString: = Edit1.Text;. To change the shown Text in Edit1, you can use Edit1.Text := myString;.


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:

  • Select the TEdit on your form with one click.
  • Go to the properties tab in the Object Inspector.
  • Select the property Text and change it in the next input box.
  • In the same way, you can select the property Name and give the TEdit a better name.


Password input

You can also easily use a TEdit to enter passwords. It is then instead of actually entered Char a PasswordChar displayed.

Little Example:

  • Create a new GUI application with a TEdit Edit1 and a TButton Button1 on the form.
  • In the Object Inspector set the property PasswordChar of Edit1 to a " * ".
  • In the event handler of OnClick of Button1 show the entered password: ShowMessage(Edit1.Text);

Special edit fields

TMemo - A multiline text edit box
TLabeledEdit - An edit field like a TEdit with a label
TMaskEdit - An edit field with an edit mask
TSpinEdit - An edit field for integers defined numbers range limits
TFloatSpinEdit - An edit field for tiles floating-point numbers with defined numbers range limits
TEditButton - An edit field like a TEdit with an attached button as a TSpeedButton
TFileNameEdit - An edit field with attached TOpenDialog, to enter a file name
TDirectoryEdit - An edit field with attached TSelectDirectoryDialog, to enter a file path
TDateEdit - An edit field with attached TCalendarDialog (calendar), to enter a date
TCalcEdit - An input field with attached TCalculatorDialog (Calculator), to enter a number



Return To: LCL Components  — Previous: TLabel Next: TMemo


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


--Michl 09:18, 16 May 2014 (CEST)