Friday, April 28, 2006

The Control and the view

I was struggling with thisproblem for last couple of days. The problem is that I want an application which supports multiple views and one of these views has a listbox. A control having a listbox will inherit from CCoeControl and override interesting operations whereas a control which is a view will inherit from CAknView, which contains methods for switching views etc.

The most obvois way out, aka making this view inherit from both CCoeControl and CAknView does not works. So I was struck with this problem for about a week.

I just finished checking out the multiviews exmaple and there I found a solution to this problem. The idea is to follow the view and container model. The view will inherit from CAknView while the container will inherit from CCoeControl.

WORKING
The UI will maintain a reference to the views. The views WILL INCLUDE the container. The container will inform view of the appropriate actions, the view will update the UI of the same, which will propogate these events to DOC.

BUGS
Was missing a call to AddToStackL() in the UI and the listbox wasn't processing arrow keys. However it was still processing clicks.