Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to control visibility of a setting item in Setting Listbox

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: kiranmudiyam (27 Sep 2007)
Last edited: hamishwillee (26 Jul 2012)

CAknSettingItemList is defined in aknsettingitemlist.h. Creating settings items is discussed Create Dynamic Settings Pages using Symbian C++

Create setting item listbox from resource with some items in it.

iListBox = new ( ELeave ) CAknSettingItemList;
-----
-----
iListBox->ConstructFromResourceL(R_SETTINGS_LIST )
iListBox->ActivateL();

To hide an item or make invisible SetHidden(ETrue) is to be called on that item.

(*(iListBox->SettingItemArray()))[index]->SetHidden(ETrue);

The setting item array must have to be notified of this by calling CAknSettingItemList::HandleChangeInItemArrayOrVisibility

iListBox->HandleChangeInItemArrayOrVisibilityL();

Note that the items are hidden and not deleted. They can still be accessed using (*SettingItemArray())[index] where index indicates the hidden item number.

Also that SettingItemArray()->MdcaCount() gives only the visible number of items (because of which one may think that the hidden item is deleted. ) SettingItemArray()->Count() gives the total number of items in the SettingList (visible + invisible).

SettingItemArray()->VisibleCount ( ) Returns the number of visible items.

Use Cases

Hide one setting item to prevent the situation where two settings items should not be simultaneously switched ON.


Example Project

The types of settings item that can appear in a list can be found here.

The following sample application creates a slider control setting item and becomes invisible when you select “Hidden” from Options menu.

File:HideSliderSettingItem.zip

Internal Links

This page was last modified on 26 July 2012, at 03:21.
47 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×