home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18922 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  2.1 KB

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