"Carlos Araujo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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
>
> I include the header of the class FrmPrincipal:
> #include "FrmPrincipal.h"
>
> The whole code of the AppHandleEvent function is the
> follow:
>
> static Boolean AppHandleEvent(EventType* pEvent)
> {
> UInt16 formId;
> FormType* pForm;
> Boolean handled = false;
>
> if (pEvent->eType == frmLoadEvent) {
> formId = pEvent->data.frmLoad.formID;
>
> pForm = FrmInitForm(formId);
> FrmSetActiveForm(pForm);
>
> switch (formId) {
> case formPrincipal:
> {
> FrmPrincipal * frmPrincipal = new FrmPrincipal();
>
>
> FrmSetEventHandler(pForm,
> &FrmPrincipal::manipuladorFormPrincipal);
> break;
> }
>
> default:
> break;
> }
> handled = true;
> }
>
> return handled;
> }
>
> PLEASE HELP ME
>
>
>
>
>
> _______________________________________________________
> Yahoo! Acesso Gr�tis - Internet r�pida e gr�tis. Instale o discador agora!
http://br.acesso.yahoo.com/
>
Another example using a C intermediary that invokes the event handler method
in your object.
Define a function that invokes your event handler method:
static FrmPrincipal * frmPrincipal;
/**
* Event handler.
*
* @return true if the event was handled, else false.
*/
static Boolean eventHandlerCallback(EventPtr eventP) {
if(frmPrincipal ) {
return frmPrincipal ->manipuladorFormPrincipal(eventP);
}
return false;
}
In your existing code:
frmPrincipal = new FrmPrincipal();
FrmSetEventHandler(pForm, eventHandlerCallback);
Ralph
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/