0

I think I've been developing Delphi the wrong way.

There seems to be a lot of information on how, but limited source code. The documents I look at in Google and Stack Overflow seems to just explain without showing hardly much source code. I would like to see a actual project where a developer has split the two into two different source code files.

Is there anywhere I can find an actual project that splits these files and shows and they can work together?

Is this to be in designtime code?

    property BreakString: String read FBreakString write SetBreakString stored gtBreakStringIsStored;

    property StoppingCount: integer read FStoppingCount write FStoppingCount default -1;

    property AutoSaveBeforeOnProcessEnd: Boolean read FAutoSaveBeforeOnProcessEnd write FAutoSaveBeforeOnProcessEnd;
    property AutoSaveAsYouModifyData: Boolean read FAutoSaveAsYouModifyData write FAutoSaveAsYouModifyData;

If the above is design time code, then how do you use it in runtime code?

halfer
  • 19,824
  • 17
  • 99
  • 186
El Diablo
  • 168
  • 1
  • 12
  • 1
    You can look at any component source code such as the VCL source itself, or the JEDI VCL, or any other component set you like. Any component that has both a runtime and designtime package will show you the proper way to separate them. Also, you can't ask us to recommend a book, tutorial or any other off-site resource; that's off-topic according to [What topics can I ask about here?](http://stackoverflow.com/help/on-topic). – Ken White Jan 01 '20 at 13:58
  • You can also read http://delphi.wikia.com/wiki/Creating_Packages and https://stackoverflow.com/q/763075/62576 – Ken White Jan 01 '20 at 14:07
  • There's an example of a relatively simple design code separation (it separates out the component registration from the runtime code) in https://stackoverflow.com/a/5465826/62576 The designtime code is in the code block marked as being the *registration unit*. – Ken White Jan 01 '20 at 14:18
  • 2
    An excellent example of separating out design and runtime code is in [Whatever happened to Proxies.pas](https://edn.embarcadero.com/article/27717), written by Jeff Overcash when the IDE was changed to enforce separation of the two. – Ken White Jan 01 '20 at 14:45
  • 1
    Basically everything (in code) you need at runtime (aka in your application) needs to be in the runtime package. Then only the things you need at design time (aka in the Delphi IDE) go into the design time package (like the ‘RegisterComponent’ and optional ‘property editors’). The code you showed should probably be in the runtime package as you stated you need it atruntime... – R. Hoek Jan 02 '20 at 14:07

0 Answers0