CAknSelectionListDialog

Login to reply to this topic.
Wed, 2004-12-22 10:38
Joined: 2004-11-18
Forum posts: 4
Hi Everyone,

I am creating SelectionList Dialog box using CAknSelectionListDialog class with my own menu bar  like this,
CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL(openedItem, NULL,  R_OPTIONS_MENUBAR);
where R_OPTIONS_MENUBAR is a menu resource with five menu items.
I want to know where to handle the Menu Commands?

Thanks
RaviTiwari

Mon, 2004-12-27 20:41
Joined: 2004-01-06
Forum posts: 18
CAknSelectionListDialog
Write your own class which you inherit CAknSelectionListDialog and then over write ProcessCommandL (TInt aCommandId) method.

e.g.

class YourOwn, public CAknSelectionListDialog
{
.....
void  ProcessCommandL (TInt aCommandId);
....
}
Mon, 2005-01-03 19:03
Joined: 2004-09-06
Forum posts: 349
CAknSelectionListDialog
I tried to use the CAknSelectionListDialog with my own menu, but the menu didn't show. I only see the CBA buttons, and if I remove them, there are no buttons at all. Here's the code:

Resources:
Code:
RESOURCE DIALOG r_dlg_contacts
{
flags = EAknDialogSelectionList;
buttons = r_softkeys_options_choose;
items = {
DLG_LINE {
type = EAknCtSingleGraphicListBox;
id = ESelectionListControl;
control = LISTBOX { flags = EAknListBoxSelectionList; };
}, // the next dlg line is optional.
DLG_LINE {
itemflags = EEikDlgItemNonFocusing;
id = EFindControl;
type = EAknCtSelectionListFixedFind;
}
};
}

RESOURCE CBA r_softkeys_options_choose
{
buttons = {
CBA_BUTTON {
id = EAdrFindAlternatives;
txt = "Alternativ";
},
CBA_BUTTON {
id = EAdrFindType;
txt = "Välj";
}
};
}

RESOURCE MENU_BAR r_res_id_for_a_menubar_2
{
titles =
{
MENU_TITLE { menu_pane = r_res_id_for_a_menupane; }
};
}

RESOURCE MENU_PANE r_res_id_for_a_menupane
{
   items= {
       MENU_ITEM { command=EAknCmdExit; txt="Exit"; },
       MENU_ITEM { command=ERetreiveAddressCmd; txt="Spara"; }
};
}

Code:
Code:
CTerminalAppContactsList* theDlg = CTerminalAppContactsList::NewL(iSelectedItem, iTextArray,
R_RES_ID_FOR_A_MENUBAR_2, this);

theDlg->PrepareLC(R_DLG_CONTACTS);

theDlg->SetIconArrayL(icons);
   CleanupStack::Pop();    // POP Icon

TInt result = theDlg->RunLD();

Code:
CTerminalAppContactsList*
CTerminalAppContactsList::
NewL(TInt& aOpenedItem, MDesCArray* aArray, TInt aMenuBarResourceId, MEikCommandObserver* aCommand)
{
CTerminalAppContactsList* self = NewLC(aOpenedItem, aArray, aMenuBarResourceId, aCommand);
CleanupStack::Pop();
return self;
}

CTerminalAppContactsList*
CTerminalAppContactsList::
NewLC(TInt& aOpenedItem, MDesCArray* aArray, TInt aMenuBarResourceId, MEikCommandObserver* aCommand)
{
CTerminalAppContactsList* self = new(ELeave) CTerminalAppContactsList(aOpenedItem, aArray,
aCommand);
//NOTE: Even if I change the above line to
// CTerminalAppContactsList* self = (CTerminalAppContactsList*) CAknSelectionListDialog::NewLC(aOpenedItem, aArray, aMenuBarResourceId, aCommand);
// I don't see my menu. Also note, that then doesn't my ProcessCommandL and OkToExit functions get triggered in the dialog.


CleanupStack::PushL(self);
self->ConstructL(aMenuBarResourceId);
return self;
}

void
CTerminalAppContactsList::
ConstructL(TInt aMenuBarResourceId)
{
// CreateMenuBarL(aMenuBarResourceId); //This cannot be used since it is protected in CAknDialog. How do I do it?
}

CTerminalAppContactsList::
CTerminalAppContactsList(TInt& aOpenedItem, MDesCArray* aArray, MEikCommandObserver* aCommand)
: CAknSelectionListDialog(aOpenedItem, aArray, aCommand) {}

Sat, 2005-01-29 20:34
Anonymous (not verified)
Forum posts: 2043
Re: CAknSelectionListDialog
Quote from: ravitiwari
I want to know where to handle the Menu Commands?

Create a new class, inherited from MEikCommandObserver. It needs to have a void ProcessCommandL (TInt aCommand) method that will be called when a menu item is selected. Pass the pointer to this MEikCommandObserver-descendant object when your create your CAknSelectionListDialog wth NewL.

Bye,
  Gabor
Tue, 2005-03-15 07:14
Joined: 2005-03-15
Forum posts: 1
CAknSelectionListDialog
To get your menu visible, try this instead:

Code:
void CTerminalAppContactsList::ConstructL(TInt aMenuBarResourceId)
{
  CAknSelectionListDialog::ConstructL(aMenuBarResourceId);
}

BR,
Richard
  • Login to reply to this topic.