Board index » delphi » Dynamic Constant Arrays

Dynamic Constant Arrays


2004-12-10 07:23:13 AM
delphi11
Please excuse me, but it has been years since I have needed to use the
newsgroup and I can't find the "general" group to post this question in.
Can someone either help me with my question below or point me somewhere
I might can get help?
I have been successful at defining a multi-dimensional constant array.
But now I have a situation where the inner array may vary in number of
elements needed for each out array entry.
I can't figure out how to define a multi-dimensional dynamic constant
array. Can anyone give me an example?
Here is a sample of what I want to do.
----------
type
TInnerDataRecord = record
SomeOtherField1: String ;
SomeOtherField2: String ;
end ;
TaInnerData = array of TInnerDataRecord ;
TOuterDataRecord = record
SomeField: Integer ;
aInnerData: TaStateData
end ;
TaOuterData = array[1..2] of TOuterDataRecord ;
const
aMyData: TaOuterData =
(
( SomeField: 12; aInnerData: ((SomeOtherField1: 'Data1';
SomeOtherField2: 'Data2'), (SomeOtherField1: 'Data3'; SomeOtherField2:
'Data4')); ),
( SomeField: 64; aInnerData: ((SomeOtherField1: 'Data5';
SomeOtherField2: 'Data6'));)
( SomeField: 75; aInnerData: ((SomeOtherField1: 'Data7';
SomeOtherField2: 'Data8'));)
) ;
----------
Thanks for any help you can give me...
Wayne
 
 

Re:Dynamic Constant Arrays

<Sorry about the re-post but there were some errors in my sample.>
Please excuse me, but it has been years since I have needed to use the
newsgroup and I can't find the "general" group to post this question in.
Can someone either help me with my question below or point me somewhere
I might can get help?
I have been successful at defining a multi-dimensional constant array.
But now I have a situation where the inner array may vary in number of
elements needed for each out array entry.
I can't figure out how to define a multi-dimensional dynamic constant
array. Can anyone give me an example?
Here is a sample of what I want to do.
----------
type
TInnerDataRecord = record
SomeOtherField1: String ;
SomeOtherField2: String ;
end ;
TaInnerData = array of TInnerDataRecord ; // NOTE: This is a dynamic
array
TOuterDataRecord = record
SomeField: Integer ;
aInnerData: TaInnerData ; // NOTE: this is a dynamic array
end ;
TaOuterData = array[1..2] of TOuterDataRecord ;
const
aMyData: TaOuterData =
(
( SomeField: 12; aInnerData: ((SomeOtherField1: 'Data1';
SomeOtherField2: 'Data2'), (SomeOtherField1: 'Data3'; SomeOtherField2:
'Data4')); ),
( SomeField: 64; aInnerData: ((SomeOtherField1: 'Data5';
SomeOtherField2: 'Data6'));)
( SomeField: 75; aInnerData: ((SomeOtherField1: 'Data7';
SomeOtherField2: 'Data8'));)
) ;
----------
Thanks for any help you can give me...
Wayne
 

Re:Dynamic Constant Arrays

Wayne Fulcher writes:
Quote
Please excuse me, but it has been years since I have needed to use
the newsgroup and I can't find the "general" group to post this
question in. Can someone either help me with my question below or
point me somewhere I might can get help?
The best place for the discussion of dynarrays is
borland.public.delphi.language.delphi.general
Quote
I have been successful at defining a multi-dimensional constant array.
But now I have a situation where the inner array may vary in number
of elements needed for each out array entry. I can't figure out
how to define a multi-dimensional dynamic constant array.
Well, if it is constant, it is not dynamic. In Delphi for .NET, which
has a slightly different approach to arrays (because of .NET), you can
perhaps define such constants, but not in Delphi for Win32.
--
Rudy Velthuis [TeamB]
"To err is human, but to really foul things up requires a computer."
-- Farmers' Almanac, 1978.