Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Hi all,

I am facing a problem with viewport widget class. I tried with a big image.
From the documents it is understands that viewport widget will handle up, down, right and left events. But my sample app fails handling this.

My source code is here, help me .... :mad:

void viewPort(sample* pApp)
{
IImage* image = ISHELL_LoadImage(pApp->a.m_pIShell , "fs:/shared/image022.jpg");

ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_FORM, (void**)&pApp->mainForm);//Main Form
ISHELL_CreateInstance(pApp->a.m_pIShell , AEECLSID_VIEWPORTWIDGET ,(void**)&viewPortW);
ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_IMAGEWIDGET, (void**)&imageW);//Container Widget

IWIDGET_SetBGColor(imageW, MAKE_RGB(0,0,255));
IWIDGET_SetImage(imageW, image);

HANDLERDESC_Init(&viewPortHandler, (PFNNOTIFY)viewPort_HANDLER, pApp, 0);
IWIDGET_SetHandler(viewPortW, &viewPortHandler);

IDECORATOR_SetWidget((IDecorator*)viewPortW, image);

IFORM_SetWidget(pApp->mainForm, WID_FORM, imageW);
IROOTFORM_PushForm(pApp->rootForm, pApp->mainForm );

The function viewPort_HANDLER is never call when select up, down keys...

Thanks
Premlal

Help ....:mad: :mad: :mad: :mad: :mad:

Help ....:mad: :mad: :mad: :mad: :mad:

This is wrong:
IDECORATOR_SetWidget((IDecorator*)viewPortW, image);
IFORM_SetWidget(pApp->mainForm, WID_FORM, imageW);
This is right:
IDECORATOR_SetWidget(IDECORATOR_TO_IWIDGET(viewPortW), imageW);
IFORM_SetWidget(pApp->mainForm, WID_FORM, IDECORATOR_TO_IWIDGET(viewPortW));
-Erik

This is wrong:
IDECORATOR_SetWidget((IDecorator*)viewPortW, image);
IFORM_SetWidget(pApp->mainForm, WID_FORM, imageW);
This is right:
IDECORATOR_SetWidget(IDECORATOR_TO_IWIDGET(viewPortW), imageW);
IFORM_SetWidget(pApp->mainForm, WID_FORM, IDECORATOR_TO_IWIDGET(viewPortW));
-Erik