Re: Vibrate on setting item
in general you would not use settings list items to catch user changing them, basically user would change the settings items and then select some otehr action in which you would first load thge setting liost values from the UI components to teh variables associated with them, and then use/save the values.
So you might want to re-think the UI you want to use for user action here. Basically if you would want to catch the event user pressing the setting list itenm, you could try overwriting the HandleSettingPageEventL function.
Re: Vibrate on setting item
thanks yucca,
I checked the radiobutton example [url]http://www.developer.nokia.com/Community/Wiki/CS001118_-_Creating_a_radio_button_settings_page[/url]
It is working fine but it has only one setting item(radiobutton), but when the settings page open it directly displays the popup menu of radio button. I have two items ( binarypopup and enumerated ) in my settings page and want them to display and when i click on binarypopup item it should vibrate if it's value is chosen as ON
(Refer to code below) when I try to use item10->SetSettingPageObserver() or item10->ExecuteLD() I am getting error as undefined idetified on both functions. I have my Settingview inherited from CCoecontrol and MAknSettingPageObserver
What should I do to resolve it?
Re: Vibrate on setting item
basically just take the example you pointerd to, add your controls into the resource, and check in HandleSettingPageEventL when your selected item is clicked by the user.
Re: Vibrate on setting item
I tried that, but HandleSettingPageEventL is never called. I guess we have to add these 2 lines below ( as in Radiobutton example which is working fine in radio button) but when i put in my code these functions are 'undefined identifier'
item->SetSettingPageObserver(this);
item->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
I am thinking it's because of the way the item is created
CAknRadioButtonSettingPage* item=new (ELeave) CAknRadioButtonSettingPage(R_EXAMPLE_SETTING_PAGE,iSelection, array);
and
CAknEnumeratedTextPopupSettingItem* item1= new (ELeave) CAknEnumeratedTextPopupSettingItem(9, iEnumText);
??
Re: Vibrate on setting item
Uups, gotta say that I missed how the example was made, I have to say that I'm not certain what the person who made that was thinking or going after. I would suggest actually using the HandleSettingPageEventL inside the settings list, and not in any external class. Then it would be called nicely without any additional things.
Re: Vibrate on setting item
It is indeed inside Setting List
SettingList::ConstructL(){
...
iItemList = new (ELeave) CAknSettingItemList;
iItemList->ConstructFromResourceL(R_DYNAMIC_LIST);
LoadListL();
...
}
SettingList::LoadList(){
//Radio button from example
CDesCArrayFlat *array = CreateRadionButtonOptionsLC();
CAknRadioButtonSettingPage* dialog =
new (ELeave) CAknRadioButtonSettingPage(R_EXAMPLE_SETTING_PAGE, iSelection, array);
CleanupStack::PushL(dialog);
dialog->ConstructL();
CleanupStack::Pop();//dialog
dialog->SetSettingPageObserver(this);
dialog->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
CleanupStack::PopAndDestroy(); //array
//from Dynamic Setting List Example
TBool isNumberedStyle = iItemList->IsNumberedStyle();
CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
//Binary popup setting item
CAknBinaryPopupSettingItem* item10 = new (ELeave) CAknBinaryPopupSettingItem(10, iBinary);
CleanupStack::PushL(item10);
// The same resource id can be used for multiple binary setting pages.
item10->ConstructL(isNumberedStyle, 10, KName10, icons, R_BINARY_SETTING_PAGE, -1, 0, R_POPUP_SETTING_BINARY_TEXTS);
// Load texts dynamically.
texts = item10->EnumeratedTextArray();
texts->ResetAndDestroy();
// Text 1
text = KBinaryText1().AllocLC();
enumText = new (ELeave) CAknEnumeratedText(0, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
// Text 2
text = KBinaryText2().AllocLC();
enumText = new (ELeave) CAknEnumeratedText(1, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
item10->LoadL();
iItemList->SettingItemArray()->AppendL(item9);
CleanupStack::Pop(item9);
}
Now when i open this view, radio button options pop up at first and when i select any of the options HandleSettingPageEventL() is indeed called, but when the Binary option window is shown and I change the options On/Off HandleSettingPageEventL () isn't called.
SettingList.h is inherited from Ccoecontrol and MAknSettingPageObserver
Re: Vibrate on setting item
I would suggest debugging ti again, indeed it should be called for all controls.
Re: Vibrate on setting item
I have debugged it, still can't figure out the problem. Any help ??
Or if anyone can provide any alternate solution for vibrating the phone when the user selects a option in Settings ( for eg: in CAknBinaryPopupSettingItem)