Tools APIOptions |
|
Open Tools API
|
The new Tools API lets you examine and modify a project's options and
environment options. Each option is identified by name, e.g., DesigntimeOnly, and has a
type and value. The type is usually Integer, Enumeration, or String. If the type is
Enumeration, you don't get to see the enumerated literals, only the ordinal values. You
need to know what the values mean, e.g., 0 for False, and 1 for True. You can cast the
ordinal value to the desired type, and when setting a value, you can use an enumerated
literal. Delphi will automatically grab the ordinal value. Every project has the same list of options, which is the union of all possible project options, including C++ projects, packages, applications, and libraries. You need to determine which options are meaningful for your project. Given a project interface, use To get the environment options, use Once you have the options interface, they work the same way for environment or project options. IOTAOptionsAn options interface lets you get or set any option. Call If you get an option type wrong, Delphi raises an invariant type error. If you specify an invalid option, Delphi ignores it. For example, if you write a project wizard that creates a package, but you want the package to be design-time only, do the following: procedure TMyPackageWizard.Execute; var Project: IOTAProject; Options: IOTAProjectOptions; begin with BorlandIDEServices as IOTAModuleServices do Project := CreateModule(TMyCreator.Create) as IOTAProject; Options := Project.ProjectOptions; Options.Values['DesigntimeOnly'] := True; Options.Values['RuntimeOnly'] := False; end; |
Copyright © 1998 Tempest Software, Inc. All rights reserved.