我正在尝试减少数量Uses
并遇到问题Enums
(* original unit, where types are defined etc *)
unit unit1;
type
TSomeEnumType = (setValue1, setValue2, ...);
...
(* global unit where all types are linked *)
unit unit2;
uses unit1;
type
TSomeEnumType = unit1.TSomeEnumType;
...
(* form unit that will use the global unit *)
unit unitform;
uses unit2;
...
procedure FormCreate(Sender : TObject);
var ATypeTest : TSomeEnumType;
begin
ATypeTest := setValue1; (* error says undeclared *)
ATypeTest := TSomeEnumType(0); (* Works but there's not point in use enum *)
end;
...
问题是在unitform中setValue1
说它是未声明的。我怎样才能解决这个问题?