[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice
Subject: Re: I give up.
From: Thomas <zander () xs4all ! nl>
Date: 2000-06-25 16:00:26
[Download RAW message or body]
> > A simple OO rule; creation of child objects is done in one place, this
> > ensures that data consistency is always maintained. Just look at the \
> > amount
> > of: new KWFrame calls
> > a KWFrame* KWFrameSet::createNewFrame() would have been much nicer.
>
> Why not just change it to work like that then? Also I don't agree that \
> this is always the best way, here it might make sense, yes. In many ways \
> it is much nicer to pass the parent to the child in the constructor.
>
That is not what I meant, OO is about objects doing only what they need
to know.
Let me see; Ahh yes I was coding the framedia.cc
the Constructur for framedia is:
KWFrameDia::KWFrameDia( QWidget* parent, const char* name, KWFrame *_frame, \
KWordDocument *_doc, KWPage *_page, int _flags, KWFrameSet *fs )
: KDialogBase( Tabbed, i18n("Frame settings"), Ok | Cancel, Ok, parent, \
name, true)
When I look at that I see that I receive a Name, a Frame, a Doc, a Page and \
a Frameset. This dialog is about ONE frame's properties. So the things I \
need should all be in the frame. I should be able to ask the frame which \
frameset is belongs to, but also which page it is on. The document it \
belongs to could be asked like: frame->getFrameset()->getDocument();
The flags determine which tabs are shown. This is simply not neccecarry, \
nor is it good GUI design (all relevant options should be visible)
The flags are also used so some standard settings are made in the dialog, \
this again is simply faulty desing. The dialog should only touch the \
settings which it can configure.
Summery:
KDocument has a number of framesets which contain a number of frames.
The info a frame needs to know (what type of frame it is for instance) \
needs to be embedded in the frame, and nowhere else.
Creating a new frame forces you to ambed it in a frameset, so find the \
first relevant frameset (or create one) and add the frame by calling:
frameset->createNewFrame()
This will create understandable code.
--
Thomas Zander \
zander@earthling.net The only thing worse than failure is the fear of \
trying something new
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic