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.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Mark Howard
> Sent: Monday, 23 August 1999 10:33
> To: Multiple recipients of list delphi
> Subject: [DUG]: Conditional Declaration
>
>
> Hi Guys
>
> Another Newbie question.
>
> I have several different user sites, each with slightly different
> versions of the programme. To date, I have accomodated this by having
> the programme's unchanging core units in an application directory and
> individual versions of the units that differ in seperate site
> directories. This has worked well.
>
> What I now want to do is to have a menu option on the Main form (and a
> modal "report definition" form that is called by the menu's on click
> event) available for one site only and none of the others.
>
> I know I can show a message saying "This report not
> available" for each
> of the other sites if they select that menu option (not nice)
> but how do
> I avoid having to declare a dummy "report definition" form in each of
> the other sites versions of the project.
>
> I hope that I have described the situation clearly enough.
>
> Mark
>
> --------------------------------------------------------------
> -------------
> New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz