Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

conditional compilation in DFM?

98 views
Skip to first unread message

Wolfgang Zehntner

unread,
Mar 4, 2003, 12:03:01 PM3/4/03
to
Jerry Blumenthal schrieb:
> I have two versions of a program with slightly different data structures.
> I'd like to maintain one set of source code only. Is it possible to
> conditionally define within a dFM file?
>
> I know I can conditionally define a tfield
>
> {$ifdefine app1}
> mystring : TStringField;
> {$else}
> myInt : TIntegerField;
> {$endif}
>
> But what about the edit components? What's the best way to conditionally
> compile them? And to design with them?
>
> Or am I better off just duplicating the edit dialog and using one or the
> other?
>

How about creating them at run-time ?
Well, you would have to set properties like .Left, width, height ...

cheers
Wolfgang


Peter Thönell

unread,
Mar 3, 2003, 11:36:32 PM3/3/03
to

> I have two versions of a program with slightly different data structures.
> I'd like to maintain one set of source code only.

Before your application grows too big and it's too late to make the change,
I suggest looking in to using packages. If most of the application is the
same for both versions, then you can put the differences in different
packages.

You will still need one unit for each form, and one unit for each
datastructure unit, but the rest can be the same.

What I tend do is put the code common to both units into a third package,
then use that package for different "implementation packages". That way, if
a third version pops up, I'm already prepared for it. It also means that
only the differences betweeen the versions are kept in the "implementation
packages", and all similarities are kept in one "base package".

I know it sounds complicated, but once there, developement is actually more
efficient and more maintainable.


Peter Below (TeamB)

unread,
Mar 3, 2003, 2:42:25 PM3/3/03
to
In article <3e62a5a4$1...@newsgroups.borland.com>, Jerry Blumenthal wrote:
> didnt know you could do that.
>

The compiler accepts it, no problem. But the IDE will get massive
indigestion from it. You have to keep in mind that the code in your
unit does not execute at design-time, and the IDE does not evaluate
conditionals in it, as far as i know. So, what DFM should the IDE load?
It expects a $R *.DFM line anyway, not a specific filename.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

0 new messages