Search code examples
delphimigrationpackagedelphi-7delphi-xe2

Please explain package use


Please explain package use (in short sentences with small words (for Dummies)).

I just moved from D7 to XE2 and packages seem much more prevelant, and I seem to need to qualify a lot more things.

In D7 I would say uses windows and now I must say uses winapi.windows.

I find that when I call MessageDlg() I can't pass in mtError, I need to qualify it.

Before I go too far down the wrong road - what's the simple solution?

Can I somehow continue to use my old code with package names which I suspect are terminal (that is, for packages A.B.C I have auses C clause).

Can I add one statement somewhere to do this? Or configure the project.

Sorry to sound so dumb :-(


Solution

  • These are called unit scopes. Because of the new FireMonkey libraries, and the cross-platform support, it's required that you declare which unit you're referring to for types and function declarations.

    You can set defaults using Project->Options->Compiler->Unit Scope Names. This is documented as well.