|
|
User login
Feeds |
CAknSelectionListDialog
|
|||||
| Wed, 2004-12-22 10:38 | |
|
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 |
|
Forum posts: 18
e.g.
class YourOwn, public CAknSelectionListDialog
{
.....
void ProcessCommandL (TInt aCommandId);
....
}
Forum posts: 349
Resources:
{
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:
R_RES_ID_FOR_A_MENUBAR_2, this);
theDlg->PrepareLC(R_DLG_CONTACTS);
theDlg->SetIconArrayL(icons);
CleanupStack::Pop(); // POP Icon
TInt result = theDlg->RunLD();
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) {}
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
Forum posts: 1
{
CAknSelectionListDialog::ConstructL(aMenuBarResourceId);
}
BR,
Richard