Re: D2006 Object inspector component
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Mar 2008 13:28:14 +0100
"DoctorC" <ecolautti@xxxxxxxxxxxxxx> wrote in message
news:47ea20e9$0$31423$f69f905@xxxxxxxxxxxxxxxxxx
Maarten Wiltink pisze:
[...]A drawgrid.
So what do you suggest? Which component.
A _drawgrid_.
Try putting a T in front of it if you can't find it in the help.
[...]
I think about doing an object with 2 lists inside, one for the
categories and one for the values. Two kind of records
TCategory=Record
Name:String;
CatValues:TList
end;
The CatValues list will contain pointers to the records that belong to
the category of the main values list. I don't think it's worth to build
a tree as I have just 2 levels.
If you only ever need the values pre-categorised (meaning never as a
single list containing all values regardless of category), building a
tree is probably easier. It certainly isn't much work.
If you have named items, often a TStrings object (abstract class; use a
TStringList for the instance) is easiest. At every index there's not
only a Strings[] item but also an Objects[] item. Put a list (TList) of
values with each category and your tree is ready-made. Or derive from
TCollection/TCollectionItem which also gives you the tree for free.
With two lists and references between them, I'd worry about keeping
everything consistent. Having the items already organised into a tree
should keep that simpler. I'd make the items objects, by the way, not
records. Easier to put code in the right place: some of it should be
in the items.
Later I will need a similar way to display a bit different values and I
think about building them as a series of objects with list of their
children inside so I can build a tree-like structure. It won't be deep,
maybe 2 or 3 levels, so I could use the same componet to display, even
if it will need a lot more functionality as it must display multiline
text, pictures, buttons, etc. (each object will contain the list of
elements to display)
Future-proof design is a bit of a dark art, especially when you don't
know what the future will be like. You'll get better at it with experience,
but judging from your comments so far you still have some experience to go.
By which I mean to suggest that you solve the problem you have now, and
don't worry about later problems too much yet. By that same logic, you
should probably be using a stringgrid at this stage.
Groetjes,
Maarten Wiltink
.
- Follow-Ups:
- Re: D2006 Object inspector component
- From: DoctorC
- Re: D2006 Object inspector component
- References:
- D2006 Object inspector component
- From: DoctorC
- Re: D2006 Object inspector component
- From: Rob Kennedy
- Re: D2006 Object inspector component
- From: DoctorC
- Re: D2006 Object inspector component
- From: Maarten Wiltink
- Re: D2006 Object inspector component
- From: DoctorC
- Re: D2006 Object inspector component
- From: Maarten Wiltink
- Re: D2006 Object inspector component
- From: DoctorC
- D2006 Object inspector component
- Prev by Date: Re: D2006 Object inspector component
- Next by Date: Re: D2006 Object inspector component
- Previous by thread: Re: D2006 Object inspector component
- Next by thread: Re: D2006 Object inspector component
- Index(es):