Is there a Delphi option to 'lock' the design (layout) of a form against accidental changes?

前端 未结 4 572
别跟我提以往
别跟我提以往 2020-12-19 05:10

After years of Delphi development I now have hundreds of forms shared throughout our Applications. Compilation ranges from Delphi 7 through to XE, thus one form might be ope

4条回答
  •  无人及你
    2020-12-19 05:23

    Helo

    I am pretty sure that Delphi has no such a thing. I have been searching for a solution to this problem as well.

    But, theres one thing you can do: You can write your own Delphi addon using OTA (Open Tools API). I know that there are a few classes which are able to notify you when something are about to be saved. You can intercept this event and decide if you wanna save it (in your case, if it is a DFM).

    BTW, if you have plans to do such component, tell me. :)

    EDIT:

    I have found a piece of code that may help you. Extracted from http://www.gexperts.org/otafaq.html

      TMyFormNotifier = class(TNotifierObject, IOTANotifier, IOTAFormNotifier)
      protected
         procedure FormActivated;
         procedure FormSaving;
         procedure ComponentRenamed(ComponentHandle: TOTAHandle; const OldName, NewName: string);
      end;
    

提交回复
热议问题