home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cimshop!davidm
- From: davidm@consilium.com (David S. Masterson)
- Newsgroups: comp.lang.c++
- Subject: Re: Callbacks in C++
- Message-ID: <DAVIDM.93Jan10225424@consilium.com>
- Date: 11 Jan 93 06:54:24 GMT
- References: <1iikcuINN6fr@news.cerf.net> <rmartin.726677907@thor>
- <1iqqipINN11b@news.cerf.net>
- Sender: root@cimshop.UUCP
- Distribution: comp
- Organization: Consilium Inc., Mountain View, California
- Lines: 35
- In-reply-to: hlf@nic.cerf.net's message of 11 Jan 93 03:46:33 GMT
- X-Posting-Software: GNUS 3.13 [ NNTP-based News Reader for GNU Emacs ]
-
- >>>>> On 11 Jan 93 03:46:33 GMT, hlf@nic.cerf.net (Howard Ferguson) said:
-
- > If I derive from the ButtonCallback (supplied by the class library) then I
- > presume I will have to overwrite the ButtonHasBeenClicked() function which
- > is a member of the ButtonCallback to do something like this
-
- > UserButtonCallback::ButtonHasBeenClicked(Buttonvoid *userInfo)
- > {
- > switch (userInfo) {
- > case SAVE : display->save_screen();
- > break;
- > case ZOOM : display->zoom_screen();
- > break;
- > }
-
- > I can see where your suggestion of deriving from a pure virtual would be
- > very useful in the situation where the number and types of callbacks are
- > restricted -- but does it provide any easy way of getting the functionality
- > required for the example just given ???????
-
- Your code assumes that there is one button on the display and, therefore, one
- callback that is invoked for that button. In reality, the SAVE and ZOOM
- button are two different buttons and they should, therefore, have their own
- callbacks that do specifically what they want. When each button is
- constructed on the display, it should tell the system what its callback is.
- That callback is specific to that button.
- --
- ====================================================================
- David Masterson Consilium, Inc.
- (415) 691-6311 640 Clyde Ct.
- davidm@consilium.com Mtn. View, CA 94043
- ====================================================================
- "Is not the whole world a vast house of assignation to which the filing system
- has been lost?"
- -- Quentin Crisp
-