Learn Delphi Programming | Unit 7.2 | Assigning Names To Your Delphi Components

preview_player
Показать описание

-- Download some video lessons for FREE
-- Download some Delphi project files used in tutorials for FREE
-- Download some PDF lesson instructions for FREE
-- Participate in chats and discussions
-- Get Early access to new tutorials
-- No need to signup and no obligation
PS: SORT VIDEOS FROM EARLIEST TO LATEST TO START AT THE BEGINNING

----------------------------------------
Delphi Programming Tutorial - Unit 7.2: Assigning Names To Your Delphi Components:

In this tutorial we learn how to assign names to our Delphi components. We apply the naming rules and naming conventions that we've learned in the previous Delphi tutorial to the Delphi program that we worked in earlier Delphi tutorials.

For each of the Delphi components on our Delphi Form, we change the Name property in the Object Inspector, using the proper naming rules and naming conventions. We are making changes on the Form, Panel, RichEdit, BitButton, Button, Edits, Image, Labels, CheckBox, ComboBox, SpinEdit.

We apply the general naming rules and conventions (Hungarian Naming Notation) to these names because it aids in the following:

• The type can be seen from the prefix in its name. This is useful when looking at the code outside an integrated development environment — like on a code review or printout — or when the symbol declaration is in another file from the point of use, such as a function.

• The formatting of object names may simplify some aspects of code refactoring.

• Multiple objects with similar semantics can be used in a block of code: i.e. btnFirstName and lblFirstName.

• Names can be easy to remember from knowing just their types.

• It leads to more consistent names.

• Inappropriate type casting and operations using incompatible types can be detected easily while reading code.

• In complex programs with lots of global objects (i.e. Delphi Forms), having a basic prefix notation can ease the work of finding the component inside of the editor. For example, searching for the string “btn” might find all the Button objects.

• Applying Hungarian notation in a narrower way, such as applying only for member variables, helps avoiding naming collision.

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.

Enjoy!

You may also want to visit the following resources for more information:

Рекомендации по теме
Комментарии
Автор

Most teachers/tutorials want to teach code in the console first but you have turned that convention on its ear by starting with the GUI. I had to think about that and it made sense. When the code comes, it will make more sense because the code will apply to an actual design that *does something* instead of a short snippet about how a loop works. I'm finally learning programming after 40 YEARS of false starts and giving up! I turn 65 next week and programming is finally making sense! Thank you!

drpatt