Forum > General

Program design

(1/1)

sketch:
Let's say I have a program named SystemMenu.
Then I have a unit named Help.
Then I have a unit named ContextHelp.
Then I have a unit named SoftwareInstMaint.
Then I have a unit named ShellEsc.

When the menu comes up at the bottom there are function keys available which can access Help (say F3) or ContextHelp (say F6). The escape key will activate ShellEsc that clears the current screen, say Help.

All of this works in one ginourmous monolithic file if Help, ContextHelp, SoftwareInstMaint, ShellEsc, are all functions or procedures in the SystemMenu program.

But how do I separate these into separate units? I put Help into "unit Help" and include it in SystemMenu, but then I get an error during compilation of SystemMenu.

And also for example:

--- Code: ---ShellEsc.pas(5,15) Fatal: Circular unit reference between ShellEsc and Help

--- End code ---
Where Help.pas has "USES CRT, ShellEsc;"
Where ShellEsc.pas has "USES CRT, Help;"

Blaazen:
There are two ways:

1) You can have two uses sections - one in interface and the second in implementation section.
  Unit1 has Unit2 in the first uses
  Unit2 hs Unit1 in the second uses

2) Create a new unit which does not depend on anything. You can add this new unit to uses of all your units safely.

Navigation

[0] Message Index

Go to full version