The next four tutorials shows the creation of a very simple calculator program.


Part 1 - Tutorial 18 - Uses Hungarian Notation and Creates the GUI Window


Part 2 - Tutorial 19 - Performs Calculations and String Conversions


Part 3 - Tutorial  20 - Uses RadioButtons to Select the Operator


Part 4 - Tutorial 21 - Show Error Handling - So the Program Will Not Crash, If a Certain Situation Arises.


Hungarian Notation:


  1.     Used in the Delphi and Lazarus code

  2.     Also used in other programming languages

  3.     Used in naming of components - Common in Delphi and Lazarus

  4.     Used in built-in properties - Common in Delphi and Lazarus

  5.     Other uses include names of user made variables  - Not common in Delphi and Lazarus

  6.     Tutorial 16 used the built-in color clRed

  7.     Primarily used to shorten names of components i.e. RadioButton becomes  rBtn

  8.   Also, used to label variables with the datatype in the name i.e. iNum1, iNum2 are integers. This is not normally used in user created variables in Delphi and  Lazarus

  9.    Even if you do not use Hungarian Notation for names of components, it is still important to name the variable something meaningful. i.e. Instead of  using the name Button12, use the name ButtonQuit.



Hungarian Notation Used in the Naming of Components


Bitmap Button       BitBtn

Button              btn

ComboBox            cbo

DataBase            db

Edit                ed

Form                frm

Image               img

Label               lbl

LabelEdit           lblEd

ListBox             lb

MediaPlayer         mp

Menu                m

OpenDialog          OpenDialog

PaintBox            pb

Query               qry

RadioButton         rBtn

RadioButtonGroup    rbg

Shape               shp

Table               tbl

Timer               tmr

Trackbar            tb




Hungarian Notation Used in the Lazarus Code


Align              al

BibiMode           bd

BorderIcons      bi

BorderStyle      bs

Color              cl

Cursor             cr

DragKind           dk

DragMode           dm

EchoMode           em

FormStyle          fs

HelpType           ht

PenMode            pm

PenStyle           ps

Position           po

ShowInTaskBar      st

WindowState        ws











There is some discussion on using Hungarian Notation within the programming community. The idea of Hungarian Notation is to organize how things are named and bring some uniformity to how the program is written. However, if Hungarian Notation is overused this can complicate the code and lead to longer development times. This situation can be especially true when programming in Pascal. Pascal has a very eloquent, English-Like, syntax and Hungarian Notation make the code look more like C++ than Pascal. If this occurs, much of the reasoning to use Pascal will be lost.



Hungarian Notation Links Of Interest:



Wikipedia Hungarian Notation:

http://en.wikipedia.org/wiki/Hungarian_notation


About Delphi Hungarian Notation and Naming

http://delphi.about.com/od/standards/l/bldnc.htm


Article on Hungarian Notation From Microsoft

http://msdn.microsoft.com/en-us/library/aa260976(VS.60).aspx




Video Tutorial: Free Pascal Tutorial 18 -Hungarian Notation  and Creating the GUI Window - Lazarus (8:48)






























The code for Tutorial 18, 19, 20 & 21 is found on Tutorial 21’s Page

Previous                   Next