Delphi Tutorial – Unit 8.5 – Code Shortcuts and Assistance In Delphi:
In the previous few tutorials, we learned how to write code for the events of a Delphi object. In this tutorial, we learn how to use some of Delphi’s design time features to help us while writing code in the Code Editor.
You will see how Delphi helps you to remember the names of your objects and how all the properties and methods belonging to those objects are presented to you while typing your code.
We also learn how use short-cuts and keyboard keys to auto complete the code for us.
This will help us to type much faster and it also makes our code less error prone and free from spelling mistakes. This is made possible by forcing us to only use strictly defined names.
We replace the current statement in the Display button’s event handler with three new statements to learn and practise the lessons in this tutorial.
While typing this code the video is paused to explain the different features available for auto-completion. You learn that programmers may sometimes work on other parts of a project for long periods of time, and when it is time to write code for some objects, they tend to forget the names assigned to those objects.
To overcome this problem, you are shown how to use keyboard keys (Control + Space) in conjunction with your naming convention (prefixes) to obtain a list of objects starting with the prefix you typed. The information provided by these lists provide programmers with a vast amount of information, such as names, data types, required parameters, etc.
After programming the new statements in our event handler for the click event of the Display button must be as follows:
procedure TfrmContact.btnDisplayClick(Sender: TObject);
redOutput.Color := clYellow;
frmContact.Caption := ‘Displaying Contact Information’;
redOutput.Lines.Add(‘Displaying Contact Information’);
This code changes the colour of our TRichEdit (named redOutput) to yellow, sets the Caption of our Form (named frmContact) to the phrase “Displaying Contact Information”, and adds a new line to the TRichEdit’s (named redOutput) Lines collection.
PS. Please, help us to keep these Delphi tutorials FREE. Keep our sponsors happy and click the LIKE button. Also SHARE these Delphi tutorials with your friends and encourage them to also SUBSCRIBE. Participate in discussions, ask questions and tell us about your experience in the COMMENTS section of a Delphi tutorial.
This tutorial (Delphi Programming Tutorial – Unit 8.5 – Code Shortcuts and Assistance In Delphi) is best viewed in HD. To change your settings to HD:
1. Click on the gear-icon (Settings) at the bottom of the YouTube Video Player.
2. Select “720p HD” and wait a few moments for the setting to take effect.
For more Delphi video tutorials also join us at https://www.learndelphi.net.
You may also want to visit the following resources for more information: