Thanks Dennis and Aaron
Just what I wanted.
Wish I'd known about these Compiler conditionals a few months ago. Would have
made the job of maitaining different versions a lot easier. One of the problems
of being a "programmer" only half a day a week, I guess.
Mark
Dennis Chuah wrote:
> Mark,
>
> A short-term quick fix solution to your problem would be to use a
> conditional:
>
> In FormCreate you will need:
> // Hide the menu item if not compiling to the customer
> {$IFNDEF SOMESYMBOL}
> MenuItem.Visible := False;
> {$ENDIF}
>
> You will also need:
> // Use the print form if compiling for the customer
> uses SomeUnits, ...,
> {$IFDEF SOMESYMBOL}
> , FormUnit
> {$ENDIF}
> OtherUnits...
>
> and:
> // Show the form if compiling for the customer
> procedure Form1.MenuItemClick (Sender: TObject);
> begin
> {$IFDEF SOMESYMBOL}
> with PrintForm.Create (Self) do
> try ... code to open form etc.
> {$ENDIF}
> end;
>
> Since you seem to have different compiles for different clients, all you
> need to do is to add a new DEFINE into the client's project. However, with
> this approach you can quickly gain a "global class" - one that does anything
> and everything your app needs to do for all combinations of customers!
>
> A more long term solution that make use of OO techniques would be to use
> plug-ins (much like a Delphi expert). Define an interface to you
> application, eg. to add menu items. Load different plug-ins (or different
> combinations of plug-ins) for different customers. Each plug-in does a
> specific job, e.g add a menu item that when clicked will onen a modal form
> to print.
>
> You can either load the plug in statically, (ie. at compile time like you do
> now) or dynamically, like Delphi. Which approach you take will most
> probably be decided by the complexity of the differences between your
> customers.
>
> Hope this helps.
> Dennis.
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz