This is a classic C++/OS problem.  Operating Systems don't understand
the hidden 'this' argument which is passed to non static member
functions.

Some OS callbacks, like Windows Timer callbacks, have a user-data
parameter.  You specify the param when you create the timer, the idea
being that you can pass a context block, or whatever, in and use the
same proc for multiple instances.  In those cases a common approach is
to create a static callback function in your class and pass in the
'this' pointer as the user data.  The callback then casts the userdata
back to a class pointer.

I don't recall PalmOS Tables offering a user param, I seem to recall
that they pass the table pointer in.  In these instances you need to
find a way to associate a particular OS object with your 'object'.  You
could ask the OS to do it with something like the Feature Manager, but
it would probably be a lot more effective to just keep your own linked
list.

Or, if you only want to have one table instantiated at a time, make a
static class pointer to go with your static callback.

-jjf

-----Original Message-----
From: Dan Hewins [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 22, 2000 4:28 PM
To: Palm Developer Forum
Cc: [EMAIL PROTECTED]
Subject: C++ Palm Apps (Teenee)


I saw Teenee on Roadcoders.  Nice.  I looked through it and I didn't 
see anthing on Table support in Teenee.  Have you addressed the issue 
of Tables in C++?  I am curious becuse I am creating a C++ Palm OS 
app in which a class takes care of all of the table stuff (loading, 
drawing, etc.) and I have run into a road block.  I want to set a 
call-back for the table item draw routine and I can't get it to work 
any way I can think of.  I tried this->DrawItem but that wouldn't 
compile.  The best I can think of would be to create a "wrapper" 
function in the "real" world that calls my class' draw routine.  But, 
that really destroys the black-box idea...  Any thought or insight 
would be appreciated.

Thanks,
Dan Hewins
Synergy Solutions, Inc.

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to