You can add to 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.
You can also easily use a TEdit to enter passwords. It is then instead of actually entered Char a PasswordChar displayed.
- 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:
- TEdit doc
- 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 TSpeedBtn
- 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
- TTIEdit - An RTTI capable input field