delphidelphi-2010delphi-xe3delphi-ide

two different versions of the same application


I have a software made with Delphi 2010 and it is required to be used from two different departments both of them share the same data and same UI except for some changes like hide/add buttons, forms and grid columns. Therefore it is required to have two versions of the same application.

It is not possible to prompt the user on application startup to select a department I must use separate EXEs.

What is the best approach (concept) to do that within Delphi 2010 or XE3 (will upgrade later) ? Is it possible to compile with different exe names ?


Solution

  • Sounds like a maintenance nightmare, so please consider other solutions such as suggested in the comments like a login or settings file.

    If you do want to make separate exe's then you could use compiler defines and based on the define in/exclude parts of the code:

    Add a new configuration:

    enter image description here

    Add the define to the configuration: enter image description here

    Use the define in your code:

    {$IFNDEF ADVANCED}
       // Remove Event Handler
       Button1.OnClick := nil;
       // Hide Button
       Button1.Visible := False;
    {$ENDIF}