I've been trying to write a simple code editor that allows for
multiple files to be opened at the same time, and using only one TMemo or
TRichedit to do so.  My intention was to create an object like so:

type
TMainObject  =  Class(TObject)
    FName : String;
    FFileName : String;
    FLines : TStrings;
    FEnc : Boolean; // for Encryption
    FROnly : Boolean; // for ReadOnly
    FTag : Integer; // ?
End;    
        As well as some simple local to the unit variables:

Var
    MyObj : TMainObject;
    ObjList : TObjectList;
    ObjCount : Integer;

        And as the editor is created or one clicked on "New", or "Open" an
instance of MyObj would be created and added to a TObjectList so as to keep
track of them.  At the same time a new TAB would be added to the tabcontrol
so the user could move from tab to tab, with each move storing the current
lines of the editor in the former tab's object and then loading the lines of
the editor from the property of the new tab's object.    In the case of a
"New" instance all properties would be '' or False except for the FName
which would be "Untitled", and the FTag which would equal the index of the
ObjectList Item it is added as, and which also would equal the tabIndex of
the Tab it belongs to..  Another var would keep track of the count from
outside the Object.  
        The one rule I wanted to follow while doing this is that I use NO
pointers whatsoever.  But I cannot seem to find the correct syntax for
working with the object in the ObjectList I need at any particular time
without them, or without having provided a number of pre-named Vars of the
Object type so that I can reference them by name!  Yet I know I've seen this
done somewhere!  Could it have been via a special wrapper class around the
TObjectList?  Is there an easier way of doing this?     Note:  The reason I
want to do this with objects is that I can then more easily access for
read/write to similar fields in a dB table when necessary without having to
create a stream or tempfile.  
         

from Robert Meek dba Tangentals Design  CCopyright 2006

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein



_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to