I'm still trying to keep my UI and domain objects separate--I very much see the
advantages--but I also keep having similar problems. Here's an example:
I'm working on an outliner right now--something that mimics the outline
function in programs like Word and WordPerfect. You create headings and
sub-headings, move heading levels "in," "out," "up," "down," etc. I have a
simple base class to represent an outlineEntry (an individual line in an
outline). It's got properties for the entry's text, headingLevel, and whether
or not it is visible. I also have a collection of outlineEntry objects. This
ObjectList descendant represents the outline itself. Everything works well.
The problem comes with the UI. If I want to display everything & work with an
outline via something like a TMemo, there would be no problems. I'm just
passing strings between objects. But if I want to work with an outline via a
TRichEdit control I feel stuck. Although an outlineEntry object's text is
displayed on a line in a TRichEdit, what do I do if there's rich text? How can
you work with individual lines in a RichEdit control, passing information back
and forth with other classes, preserving rich text formatting (esp. if you also
want to save an outline and its outlineEntries to a file)? ... I could end up
doing all the work of formatting in the UI class, my classes will be tightly
coupled, and I will see less need for keeping the UI and domain separate
(...and we don't want that. "Danger, Will Robinson! Danger!".
I have this problem all the time--UI form objects' methods using parameters or
creating results in data types that are hard for me to pass around or work with
outside the form class. I'm thinking there is some fundamental way or mindset
involved when objects interact with each other that I am missing. Can you help
me see the light?
Thanks, as always -- Al C.
_________________________________________________________________
Stay organized with simple drag and drop from Windows Live Hotmail.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_102008
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi