Posted by Jenny, DelphiLand Team on February 08, 2008
In Reply to Re: Undeclared identifier posted by Newb on
February 07, 2008
: In order to avoid such problems in the future: is there somewhere a list of built-in Delphi routines (functions and procedures) versus the units where they are declared? Would be very helpfull! :)
For the built-in Delphi routines, this info can be found in the Help documentation. In your source code, simply put the cursor on the "undeclared" identifier and press function key F1. For example, for the routine LeftStr the Help says:
"Returns the substring of a specified length that appears at the start of a string.
Unit : StrUtils
Syntax : ..."
Alas, for some routines, like for example ShellExecute, the Help of Delphi 2006 doesn't show the unit where they are declared (should be "Unit: ShellApi" in this case). That's because ShellExecute is not a built-in Delphi function, but a function of the Windows' Application Programming Interface (API).
Luckily, there's a workaround in D2006. Near the bottom of the Help info for ShellExecute, we see:
...and from experience, we conclude that this particular routine is declared in the unit SHELLAPI.
That's a serious flaw in the Help documentation, not only for Delphi 2006, but also for previous Delphi versions/editions. In the older Delphi versions it's still worse. The regular Delphi Help docs even don't mention API functions, they can only be found in the "Win32 Programmer's Reference" ...but of course that doesn't contain info on the Delphi units where functions are declared.
It's about time that somebody puts together a comprehensive list of *all* identifiers (routines, types,
constants, and so on) versus the units where they are declared. We've just started working at it,
...just give us some time to complete the list :)
Jenny, DelphiLand Team