home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / openloo / 3653 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  2.0 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!liuida!isy!isy.liu.se!svan
  2. From: svan@isy.liu.se (Jonas Svanberg)
  3. Newsgroups: comp.windows.open-look
  4. Subject: Re: Q: C++ and callback problems.
  5. Keywords: callback OI
  6. Message-ID: <1992Aug30.171624.1330@isy.liu.se>
  7. Date: 30 Aug 92 17:16:24 GMT
  8. References: <Btpy3G.Dnu@solbourne.com>
  9. Sender: news@isy.liu.se (Lord of the News)
  10. Reply-To: svan@isy.liu.se
  11. Organization: Linkoping University
  12. Lines: 38
  13.  
  14. imp@solbourne.com (Warner Losh) replies on my article #5299 about
  15. C++ and callbacks. (article #5306)
  16.  
  17. >>How then do these toolkits handle callbacks/events?
  18. >
  19. >OI does a variation of method 1 (except that it does do non-static
  20. >member functions correctly).  Interviews uses a variation of method 2.
  21. >
  22. >>1) Cloning & modifying.
  23. >>   You create a Button-object and then modifies it by
  24. >>   registering your c-style callbackfunction.
  25. >
  26. >In OI, you can regstier a C or a C++ style callback.  Just an
  27. >overloaded call.  For example,
  28. >    OI_menu_cell *cellp;
  29. >    MyClass        *mcp;
  30. >
  31. >    // call ::foo when button activated.
  32. >    cellp->change_action( &foo );
  33. >
  34. >    // call MyClass::bar when button activated
  35. >    cellp->change_action( mcp, (OI_action_memfnp) &MyClass::bar );
  36.  
  37. What is OI_action_memfnp? For this to be a legal and portable (?) cast it
  38. has to be of type pointer-to-member-of-MyClass or a pointer-to-member-of-a-
  39. -baseclass-of-MyClass. 
  40. I suppose in this case that MyClass is derived from an OI-class? (hence the
  41. lacking of a cast of mcp in the last call.) Is it really safe to make a 
  42. member-function-call when both the objectpointer and the pointer-to-member-
  43. -function have been casted "towards the baseclass"?
  44.  
  45. ---
  46. --------------------------------------------------------------
  47.  Jonas Svanberg
  48.  Department of Electrical Engineering
  49.  Linkvping University
  50.  S-581 83 Linkvping, Sweden             Email: svan@isy.liu.se
  51. --------------------------------------------------------------
  52.