For example, let's say that you need to have 3 global variables:
- LoginTime: TDateTime;
- FileName : string;
- Total : Currency;
Now let's collect them inside a record like:
type TGlobalVars=record LoginTime: TDateTime; FileName : string; Total : Currency; end;
And declare a global variable of type TGlobalVars, like this:
var Global: TGlobalVars;
Now everytime we want to use one of the "real" global variable, we don't have to remember the exact name. Just type Global. and Delphi AutoCompletion will present you with the list like shown below.
[ATTACH]3612[/ATTACH]
I found this trick really saves me a lot of time from the necessity to open and close units just to check for variable names (is it UsrPassword, [I]UserPwd, or [I]UsrPass? for an example, :c-lol:).


Sign In
Create Account



Back to top









