home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!think.com!ames!purdue!mentor.cc.purdue.edu!biomac1g.bio.purdue.edu!user
- From: pf@bilbo.bio.purdue.edu (Paul Furbacher)
- Subject: Re: TVISION:cmQuit and clearEvent :(
- Message-ID: <pf-090193223831@biomac1g.bio.purdue.edu>
- Followup-To: comp.lang.c++
- Sender: news@mentor.cc.purdue.edu (USENET News)
- Organization: Purdue University
- References: <1993Jan9.100350.22034@sparc4.ncu.edu.tw>
- Date: Sun, 10 Jan 1993 03:48:51 GMT
- Lines: 57
-
- My mailer is broken this weekend: hopefully you'll see this
- even though you specifically request e-mail replies.
-
- In article <1993Jan9.100350.22034@sparc4.ncu.edu.tw>, oper7@ee05.ncu.edu.tw
- (Anthony Shih Hao Lee) wrote:
-
- > [when] I quit my TV app, TApplication seems not to destroy all
- > other objects which has created for my application.
-
- This is true, for objects such as collections. You have to
- handle the disposing of objects which are not inserted into
- either the application object or the desktop. To do this,
- you have to override the destructor member function of the
- Application class.
-
- > I must actively to broadcast cmQuit message to those windows
- > which has exposed on the desktop, so that they could finish their job.
-
- No. Since you own BC++&AF, look up the source for TGroup, the
- ancestor of among other things, TDesktop, TProgram and TApplication.
- You will see that calling TApplication.Done (Pascal flavor here, if you
- don't mind, = ~TApplication) you are eventually calling
- TGroup.Done. And TGroup.Done iterates through its linked list
- of inserted subviews -- be they editor windows, calculators,
- memos, ascii tables, whatever -- and calls their destructors.
- Therefore, objects inserted into TApplication and TDesktop
- descendents are properly disposed of, assuming any descendent
- destructors you may have written for any of the subviews are
- deallocate properly.
-
- > 1.
- > in fact, TApplication should broadcast some useful message such as
- > cmClose, cmQuit to announce windows on the desktop.
- > and, cmQuit message for a TApplication seems not similar to other
- > evCommand.
- > 2.
- > Due to cmQuit is the most important message which all
- > handleEvent should take response, user's TApplication::handleEvent
- > could not use clearEvent, and must pass this message to it's parent
- > handleEvent. am I wrong?
-
- Again, this is where it is up to you to create a descendent of
- TApplication and modify the destructor and possibly the HandleEvent()
- member function. Remember that if you want your descendent
- to get first crack at handling an event, place your modifying
- code ***before*** the call to the ancestor's method, especially
- in the case where you know the ancestor clears the event.
-
- And it is up to you to design the messaging between objects --
- the application framework foundation classes cannot anticipate
- all your special messaging needs. This is what inheritance is
- all about: creating descendents whose behavior is evolved to
- a greater degree of sophistication than the ancestors'.
-
- Hope this is clear enough for you to make further progress.
-
- PF
-