I should be possible to type your class method to a commone pointer.  I
think I've done it in the past, here is a old post that might shed some
light...


> NOW YOU'RE TALKING!
>
> Works perfectly. Thanks!
>
> Alan
>
> >Yeah, well, it only gets weirder from here on out. First, the program:
> >
> >class SynCanvas;
> >
> >typedef void (SynCanvas::*DrawRoutineStartType) (void);
> >
> >class SynCanvas {
> >public:
> >     DrawRoutineStartType          cToolStartCallback;  // function used
to
> >draw
> >
> >     void SketchToolDrawBrush(void);
> >     void ToolSetup() { cToolStartCallback = &SketchToolDrawBrush; };
> >};
> >
> >
> >static void Fred ()
> >{
> >     SynCanvas*     fred;
> >     SynCanvas*     ethyl;
> >
> >     (ethyl->*(fred->cToolStartCallback)) ();
> >}
> >
> >What that last line says is "get the the pointer to member function
> >contained in fred's instance of cToolStartCallback, and apply it to the
> >ethyl object". Thus, if fred->cToolStartCallback contains a pointer to
> >SketchToolDrawBrush, then that last line is effectively
> >"ethyl->SketchToolDrawBrush ()".
> >
> >Please note the "&" used when assigning the pointer-to-member-function to
> >cToolStartCallback, and the extra parentheses around the whole invocation
> >of the ptmf.
> >
> >-- Keith
> >
> >
> >
> >
> >
> >
> >Alan Pinstein <[EMAIL PROTECTED]> on 02/11/99 03:55:21 PM
> >
> >Please respond to [EMAIL PROTECTED]
> >
> >To:   [EMAIL PROTECTED]
> >cc:    (Keith Rollin/HQ/3Com)
> >Subject:  Re: C++ callbacks? (still having a problem...)
> >
> >
> >
> >
> >That's what I figured, but when I do that, then:
> > cToolStartCallback();
> >gives this error:
> >Error   : call of non-function
> >SynCanvas.cpp line 146   cToolStartCallback();
> >
> >
> >>
> >>"DrawRoutineStartType" is the type for the function pointer.  That makes
"
> >>DrawRoutineStartType*" a pointer to such a pointer.  Chuck that "*" and
> >>you'll be OK.  All you need is "DrawRoutineStartType
cToolStartCallback".
> >>
> >>-- Keith
>
>
>
>
>
----- Original Message ----- 
From: "Ben Combee" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, November 19, 2004 12:25 PM
Subject: Re: PROBLEM WITH THE HANDLE OF A FORM USING C++


> At 11:05 AM 11/19/2004, you wrote:
> >         I have a problem with the handle of a form when I set
> >the handle using the function
> >FrmSetEventHandler(pForm,
> >&FrmPrincipal::manipuladorFormPrincipal);
> >
> >         I create an object of the class FrmPrincipal like:
> >
> >         FrmPrincipal * frmPrincipal = new FrmPrincipal();
> >
> >         And then set the function: FrmSetEventHandler(pForm,
> >&FrmPrincipal::manipuladorFormPrincipal);
> >
> >         But an error occur with the reference of the member
> >function. The error is:
> >
> >
> >converting from `Boolean (FrmPrincipal::*)(EventType
> >*)' to `Boolean (*)(EventType *)'       AppMain.cpp
>
> FrmSetEventHandler expects a plain function, not a C++ method.  C++
methods
> have a hidden "this" parameter that's part of their function signature.
>
> You either need to pass a non-member function or a static member function
> to this call.  You'll need to figure out some method to associate the
> FormType pointer with your class -- maybe a gadget in the form could be
> used to store your object pointer.
>
>
> -- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc.
>     "Combee on Palm OS" weblog: http://palmos.combee.net/
>     Developer Fourm Archives:   http://news.palmos.com/read/all_forums/
>
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


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

Reply via email to