I am trying to create an application that allows one to browse a .MDB file to add/edit/delete basic personal information for fraternity alumni. It is something that I have been casually doing in my free time with little trouble, however, I have run into a snag recently.
I have a few classes in this application.
*TRhoAddress is subclass of TGroupBox with TEdits and TLabels placed on it. I use TRhoInfo.Create(AOwner) to create a new one of these. They are placed in a scrollbox/flowpanel for viewing, as our records often show multiple addresses for our alumni.
*TRhoInfo is a subclass of TCustomForm with TEdits/TLabels/TButtons and the afformentioned TFlowPanel in a TScrollBox. I had problems using a .create style constructor, and various forums advised using a .createnew constructor.
I intended the above classes to be used as components. I have a main form and a data module that I use coordinate the application. The main form contains a TDBGrid and some TEdits. As users fill out various parameters, the form pulls appropriate data from the MDB and puts it in the TDBGrid. When a cell in the TDBGrid is double clicked, the application should (a) open a TRhoInfo window (b) populate the fields from the database (c) add an entry into the TMenuBar of the main form for refocusing windows ala the Window Menu of most office applications.
I have two problems with my application right now. The first is that the TRhoInfo's that I create do not appear in the TaskBar. This is a minor annoyance that I planned on remedying with the Window menu. The second (more serious) is that upon calling TRhoInfo.Create, every previously create TRhoInfo seems to be erased.
var
Contain:Array of TRhoInfo;
i:integer;
for i:=0 to 10 do
begin
SetLength(Contain, Length(Contain) + 1); {open up an extra space}
Contain[High(Contain)] := TRhoInfo.CreateNew(Self,InttoStr(i)); {dump a new object in}
end; {repeat}
// This is the result....
// Contain[0].Name = '10';
// Contain[1].Name = '10';
// Contain[2].Name = '10';
// Contain[3].Name = '10';
// Contain[4].Name = '10';
// Contain[5].Name = '10';
// Contain[6].Name = '10';
// Contain[7].Name = '10';
// Contain[8].Name = '10';
// Contain[9].Name = '10';
It is as if I can only have one instance of TRhoInfo. I assume this means that I am only dealing with references, and I can only further assume that it has to do with the fact that I'm using CreateNew rather than Create.
To be honest, I'm stumped. I'm a competent programmer, but I only have 8 weeks experience in Delphi. Any help is appreciated.
Thanks,
TeejMonster
*Edit -- Forgot to post a link to my source. http://tinyurl.com/m4q9db