Just my 2 cents...  I've used C++ class functions as callbacks in several
applications with no ill effects.

----- Original Message -----
From: "Greg Lutz" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 5:49 PM
Subject: Re: Fw: C++ class methods as callback functions


> I disagree about the usability of C++ class methods as callback
> targets.  Everyone who has replied thus far is correct in noting
> that the *direct* callback target must be a static method, but I
> like going this route anyway: the static method finds a class
> object pointer, somewhere, and immediately forwards its arguments
> to a class method to do the actual callback processing.
>
> For a PalmOS Table, for instance, the class object pointer can be
> stashed away using TblSetRowData (for the zeroth row, for
> instance).  For Lists, I've never done it, and don't see a handy
> place to store the object pointer; but it's not too bad to simply
> store the currently relevant pointer in some static variable,
> making the code non-re-entrant, if it's clear that that's not
> going to be a problem.  Or you can make an associative map from
> PalmOS widget to C++ class object; in any case I can think of, a
> linear search would be an adequate map-lookup implementation, as
> there won't be more than a couple members in the map.
>
>





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to