×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    35

    Empty setting item list - ok, but... how?

    I have run into serious trouble, because I cannot find an working example/resource, how to create empty setting items on such list, like below:



    The lightblue highlighted item has only label, and this is exactly what I want :)
    I tried to use visual editor in Carbide, but there is no such empty control. I can find controls like: text editors, numeric editors, sliders, etc...
    Nokia's tutorials about creating settings lists also says exactly nothing about such items :/

    I tried to use resources with max length set to zero, lines set to zero, empty text - nothing works.
    I'm not able to get rid of dark blue editor field...

  2. #2
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: Empty setting item list - ok, but... how?

    Hi,

    If you don't want user to edit an item you should override the EditItemL() like this:

    Code:
    // .h
    ...
    class CUytredsaContainer : public CAknSettingItemList
    ...
    
    // .cpp
    ...
    void CUytredsaContainer::EditItemL ( TInt aIndex, TBool aCalledFromMenu )
    	{
    // begin by chen
    	if(aIndex==EUytredsaAppUiEnumeratedTextPopup1-1)
    		{
    		return; // ignore the 'edit' request, simply return
    		}
    // end by chen
    ...
    You can also protect an item like this:

    Code:
    ...
    CAknSettingItem* CUytredsaContainer::CreateSettingItemL( TInt aId )
    	{
    	switch ( aId )
    		{
    	// [[[ begin generated region: do not modify [Initializers]
    		case EUytredsaAppUiBinarySetting1:
    			{			
    			CAknBinaryPopupSettingItem* item = new ( ELeave ) 
    				CAknBinaryPopupSettingItem( 
    					aId,
    					iSettings.BinarySetting1() );
    			return item;
    			}
    		case EUytredsaAppUiEnumeratedTextPopup1:
    			{			
    			CAknEnumeratedTextPopupSettingItem* item = new ( ELeave ) 
    				CAknEnumeratedTextPopupSettingItem( 
    					aId,
    					iSettings.EnumeratedTextPopup1() );
    // begin by chen
    			item->SetProtectionState(CAknSettingItem::ESettingItemProtected);
    // end by chen
    			return item;
    			}
    ...
    See the attached example for more details.

    Regards

    Ziteng Chen
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    35

    Re: Empty setting item list - ok, but... how?

    Hi.
    Thanks for reply, but it's not a problem with protection against editing.
    I would like to have a change to launch specified action, even when user clicks such empty item.

    Quote Originally Posted by chenziteng View Post
    Code:
    item->SetProtectionState(CAknSettingItem::ESettingItemProtected);
    Unfortunately the code I'm working on, is S60 2nd Edition Symbian, and this method doesn't exist.

  4. #4
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: Empty setting item list - ok, but... how?

    Quote Originally Posted by Vymmiatacz View Post
    Hi.
    Thanks for reply, but it's not a problem with protection against editing.
    I would like to have a change to launch specified action, even when user clicks such empty item.



    Unfortunately the code I'm working on, is S60 2nd Edition Symbian, and this method doesn't exist.
    Hi,

    Then you should use the first solution which works for S60 2nd Edition too, when user tries to edit an item (by press confirm key when the item has focus, for example), the EditItemL() will be called, you should override the function to do something ("launch specified action"), and then return.

    Code:
    // .h
    ...
    class CUytredsaContainer : public CAknSettingItemList
    ...
    
    // .cpp
    ...
    void CUytredsaContainer::EditItemL ( TInt aIndex, TBool aCalledFromMenu )
    	{
    // begin by chen
    	if(aIndex==EUytredsaAppUiEnumeratedTextPopup1-1)
    		{
                    // perform the action you specified.
    		return;
    		}
    // end by chen
    ...
    Regards

    Ziteng Chen

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    35

    Re: Empty setting item list - ok, but... how?

    OK, I've already found solution. Here is an example code, maybe somebody find it useful:

    Code:
    class CAknTextSettingItemEmpty : public CAknSettingItem
    {
    public:
    	CAknTextSettingItemEmpty(const TInt aIdentifier);	
    	~CAknTextSettingItemEmpty();
    
    protected:
    	void EditItemL(const TBool aCalledFromMenu);
    	virtual const TDesC& SettingTextL();
    };
    Code:
    CAknTextSettingItemEmpty::CAknTextSettingItemEmpty(const TInt aIdentifier) : CAknSettingItem(aIdentifier)
    {
    }
    
    CAknTextSettingItemEmpty::~CAknTextSettingItemEmpty()
    {
    }
    
    void CAknTextSettingItemEmpty::EditItemL(const TBool aCalledFromMenu)
    {
    }
    
    const TDesC &CAknTextSettingItemEmpty::SettingTextL()
    {
    	return KNullDesC;
    }
    And that's all.
    It's a pity, that such example is not in official documentation.
    I had to waste several hours of my life :/ to discover it.

  6. #6
    Nokia Developer Champion
    Join Date
    May 2004
    Posts
    2,267

    Re: Empty setting item list - ok, but... how?

    Hi,

    Thank you for the sharing, and it would be better if you can put it on the wiki.

    Regards

    Ziteng Chen

Similar Threads

  1. Setting list empty type setting item
    By denial347 in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-04-05, 16:23
  2. How to activate another view on selection of Setting List item
    By rahulm in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-09-03, 01:29
  3. Normal button in Setting Item List ?
    By dracula78 in forum Symbian User Interface
    Replies: 0
    Last Post: 2007-08-31, 10:15
  4. Partly dynamically setting list problem
    By kaiten-sushi in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-05-09, 16:22
  5. How to include setting item list in a form
    By anand_zain76 in forum Symbian User Interface
    Replies: 11
    Last Post: 2006-06-01, 13:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×