My thanks to both of you for responding to my message. I am starting to think I
should save the RTF separately from the TOutline object, making sure the
RichEdit.Lines index match up with the outline's item index (each outlineEntry
text will use a single line). Doesn't exactly seem like it's separating UI and
domain, but it does seem like it would ultimately work. An outlineEntry would
still have a string field, but any special formatting of outlineEntry object
text would be accomplished in a method in the UI unit.
However, here are the method signatures for the two classes I've been talking
about (note that TOutlineEntry will eventually have another field added,
pointing to a collection of a totally different data type--but we won't worry
about that yet:
<code>
TOutlineEntry = class(TObject) text: string; level: integer;
visible: boolean; constructor Create(aText: string; aLevel: integer); end;
TOutline = class(TObjectList) private function getEntry(aindex: integer):
TOutlineEntry; procedure setEntry(aindex: integer; const Value:
TOutlineEntry); public property items[aindex: integer]: TOutlineEntry read
getEntry write setEntry; default; function add(anEntry: TOutlineEntry):
integer; function display: string; function IndexOf(aText: string):
integer; function Find(aText:string): TOutlineEntry; procedure
moveOut(aText: string); procedure moveIn(aText: string); procedure
moveUp(aText: string); procedure moveDown(aText: string); procedure
Collapse(aText: string); procedure Expand(aText: string); procedure
Save(aFile: string); procedure Open(aFile: string); end;
</code>
I don't know what I want my UI to look like yet, but I am thinking about
mimicking the interface you'd use in Word's outline view. I could, however,
have my own "outline view" (form) where users are working in plain text, and
any special formatting of outline text is done in another part of the program
(e.g., formatting could be dealt with in a different form ... it could be that
when a certain level of sub-heading is written in a paper, it should always be
indented and italicized, or a title should always be centered. It seems like
I'd be shaping the UI to the code, but it might work fine for my purposes.)
Is this any clearer now?
Thanks again; I appreciate the responses. They are always helpful to me.
Al C.
_________________________________________________________________
Store, manage and share up to 5GB with Windows Live SkyDrive.
http://skydrive.live.com/welcome.aspx?provision=1?ocid=TXT_TAGLM_WL_skydrive_102008
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi