How to move the focus in menulist text Items Form & RootForm. | developer.brewmp.com How to move the focus in menulist text Items Form & RootForm. | developer.brewmp.com

Developer

How to move the focus in menulist text Items Form & RootForm.

How to move the focus, having Form and MenuList with the scroll. By pressing key up and down in the simulator,
focus should move from one text items to below items.
static int helloformapp_CreateForm11(helloformapp *me);
1) Created root form
2) Created the form
3) Created the xycontainer
4) List widget
5) static widget
6) menu model
7) IMENUMODEL_Add(me->pMenuModel, L"Browser", 0, MMF_ENABLED);
8) IWIDGET_GetViewModel(me->pListWidget, &pListViewModel);
9) IDECORATOR_SetWidget((IDecorator *)me->pListWidget,me->pItemWidget);
10)IXYCONTAINER_Insert(me->xyContainer, me->pListWidget, WIDGET_ZNORMAL,&wpos);
11)IXYCONTAINER_QueryInterface(me->xyContainer, AEEIID_WIDGET, (void**)&me->pMenuContainer);
12)Res = IROOTFORM_PushForm(me->piRootForm, me->piForm);
13)HANDLERDESC_Init ()
question where is the problem in accessing the APIs? what are steps or senquence of call to build menulistscroll
focus movement scrolling.

I assume you forgot to mention IFORM_SetWidget(me->piForm, WID_FORM, me->pMenuContainer).
Are you calling IROOTFORM_HandleEvent() in your app's main event handler?
Try explicitly setting the focus with IWIDGET_MoveFocus(me->pMenuContainer, me->pListWidget).
-Erik

I assume you forgot to mention IFORM_SetWidget(me->piForm, WID_FORM, me->pMenuContainer).
Are you calling IROOTFORM_HandleEvent() in your app's main event handler?
Try explicitly setting the focus with IWIDGET_MoveFocus(me->pMenuContainer, me->pListWidget).
-Erik

Hi,
I really thanks for your reply, and already tried with these APIS but still not working.
I have attached the sample code in text file and let me know whether is issue.
Main functions are static int helloformapp_CreateForm11(helloformapp *me) and helloformapp_HandleEvent ().
I am really not understanding event handling mechanism provided by BUIWF framework.
I already tried with forums sample code and BREW calculator code, sample applications etc. Still not getting proper logic or flow.

Hi,
I really thanks for your reply, and already tried with these APIS but still not working.
I have attached the sample code in text file and let me know whether is issue.
Main functions are static int helloformapp_CreateForm11(helloformapp *me) and helloformapp_HandleEvent ().
I am really not understanding event handling mechanism provided by BUIWF framework.
I already tried with forums sample code and BREW calculator code, sample applications etc. Still not getting proper logic or flow.

Wow. Where to start?
Don't create your forms and widgets in the applet's constructor. Create them when your event handler receives EVT_APP_START.
Don't set the form's event handler to be the same as your app's main event handler.
In your app's main event handler you should call IROOTFORM_HandleEvent(me->piRootform, eCode, wParam, dwParam), probably near the beginning, and if that returns FALSE then handle the event yourself. The root form will pass the event to the widgets, and it will eventually be passed down to the list widget. The list widget will handle the up and down keys and change the selected item itself. You don't have to do that yourself.
Don't call HANDLERDESC_Call() at the end of your main event handler.
You're also going to be leaking your widgets, since they are never released.
-Erik

Wow. Where to start?
Don't create your forms and widgets in the applet's constructor. Create them when your event handler receives EVT_APP_START.
Don't set the form's event handler to be the same as your app's main event handler.
In your app's main event handler you should call IROOTFORM_HandleEvent(me->piRootform, eCode, wParam, dwParam), probably near the beginning, and if that returns FALSE then handle the event yourself. The root form will pass the event to the widgets, and it will eventually be passed down to the list widget. The list widget will handle the up and down keys and change the selected item itself. You don't have to do that yourself.
Don't call HANDLERDESC_Call() at the end of your main event handler.
You're also going to be leaking your widgets, since they are never released.
-Erik

Hi,
I thanks for your quick reply and suggestions. I tried as per your previous messages and changed the code many times. I called the IROOTFORM_HandleEvent() in begning, but in simulator getting crashed, may be due to allocation missing in the beginning. I call this function at the end,
in mainhandle function this function return fails.
I am new to Brew and BUIWF, and guesing may be architectural thinking is proper but implementation of that thinking is not proper. There must be Gap in architectural approach and implementation. I do not have idea that BUIWF is standard framework or not? Or better to use Brew SDK only.
ranjeet

Hi,
I thanks for your quick reply and suggestions. I tried as per your previous messages and changed the code many times. I called the IROOTFORM_HandleEvent() in begning, but in simulator getting crashed, may be due to allocation missing in the beginning. I call this function at the end,
in mainhandle function this function return fails.
I am new to Brew and BUIWF, and guesing may be architectural thinking is proper but implementation of that thinking is not proper. There must be Gap in architectural approach and implementation. I do not have idea that BUIWF is standard framework or not? Or better to use Brew SDK only.
ranjeet

hi Ranjeet
I think u should use following api
IWIDGET_SetModel(me->pListWidget,me->pMenuModel);
because u didn't associate the menu model with list widget

hi Ranjeet
I think u should use following api
IWIDGET_SetModel(me->pListWidget,me->pMenuModel);
because u didn't associate the menu model with list widget