×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    10

    CAknEnumeratedTextPopupSettingItem default is zero

    If I dont select any item in a CAknEnumeratedTextPopupSettingItem list then the default value of the selected index is always 0 !! well there is a requirement that the passed index to CAknEnumeratedTextPopupSettingItem should be zero.
    I get 0 if i leave the popup untouched if i touch and chosoe something i get right index otehr wise the index and the popup shon as selected dont match

    Tint iEnumText =0; // is must otherwise it panics.

    /*Enumerated text setting item*/
    CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(9, iEnumText);
    CleanupStack::PushL(item9);
    // The same resource id can be used for multiple enumerated text setting pages.
    item9->ConstructL(isNumberedStyle, 9, KName9, icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);

    // Load texts dynamically.
    CArrayPtr<CAknEnumeratedText>* texts = item9->EnumeratedTextArray();
    texts->ResetAndDestroy();
    CAknEnumeratedText* enumText;
    // Text 1
    HBufC* text = KEnumText1().AllocLC();
    enumText = new (ELeave) CAknEnumeratedText(0, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);
    // Text 2
    text = KEnumText2().AllocLC();
    enumText = new (ELeave) CAknEnumeratedText(1, text);
    CleanupStack::Pop(text);
    CleanupStack::PushL(enumText);
    texts->AppendL(enumText);
    CleanupStack::Pop(enumText);

    I would like to have -1 if nothing is selected or

    Is there a way to put a particular item as the first item in the popup list ?

    -A

  2. #2
    Registered User
    Join Date
    Jun 2013
    Posts
    10

    CAknEnumeratedTextPopupSettingItem - forcing an item as first

    Is it possible to force an item as default item in the popup list of CAknEnumeratedTextPopupSettingItem ? I couldnt find a mean to do it

    -A

  3. #3
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CAknEnumeratedTextPopupSettingItem - forcing an item as first

    What excatly do you mean ? you could basically set the values right after you load the resource, allowing you to have initial values there as you wish. Basically you would generally also use this to set the previously saved values back to the listbox..

  4. #4
    Registered User
    Join Date
    Jun 2013
    Posts
    10

    Re: CAknEnumeratedTextPopupSettingItem - forcing an item as first

    Im doing it dynamically .... like in dynamic settinglist example , one more thing
    // Load texts dynamically.
    CArrayPtr<CAknEnumeratedText>* texts = item9->EnumeratedTextArray();
    texts->ResetAndDestroy();
    CAknEnumeratedText* enumText;
    // Text 1
    HBufC* text = KEnumText1().AllocLC();
    enumText = new (ELeave) CAknEnumeratedText(10, text);

    I changed the value from 0 to 10 -- and the other one to 11
    interestingly iEnumText is 0 unless the control is touched! isnt it strange to have a unspecified value as the value from a list box?

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CAknEnumeratedTextPopupSettingItem - forcing an item as first

    have you tried calling DrawNow() after changes ? also are you returning the listbox pointer in the container , so the system knows how to draw them right ?

  6. #6
    Registered User
    Join Date
    Jun 2013
    Posts
    10

    Re: CAknEnumeratedTextPopupSettingItem - forcing an item as first

    showing as default is not a problem its just matter of which one comes in the code first .. Now the head ache is with the other problem I have items with value 10 11, 12 and 0 ,, and item 10 is the first item in list which is the default choice or automatically on the top when the list is created and if i try to get the Enum value (of CAknEnumeratedText) then it always retun 0 even though teh item on top is not having enum value 0!! even if I create a list with items with enum values not containing 0 still the enum value after store settingsL is still 0 for that item in the lsit. Which is totally strange to me how can it return a wrong enum value for the default selection ?

    Did i make myself clear here?

  7. #7
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: CAknEnumeratedTextPopupSettingItem - forcing an item as first

    Have you used the StoreSettingsL () to get the values from the setting list to be saved into the variables you link them to ?

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: CAknEnumeratedTextPopupSettingItem default is zero

    Merged your threads, they are related.
    Quote Originally Posted by testabu View Post
    Is it possible to force an item as default item in the popup list of CAknEnumeratedTextPopupSettingItem ? I couldnt find a mean to do it
    Quote Originally Posted by testabu View Post
    Tint iEnumText =0; // is must otherwise it panics.

    /*Enumerated text setting item*/
    CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(9, iEnumText);
    Actually this is where you would set the default value. And also this is where you get it back later, that is why you pass a reference.
    However when passing a reference, the given variable is expected to remain in scope. Otherwise StoreSettingsL will overwrite some random value on the stack, and indeed resulting either nothing or a panic.
    By Symbian naming convention, a variable called iEnumText should be a member variable (thus it would not go out of scope unless you delete the entire object while the dialog is still visible).
    The other way would be using the EAknDialogFlagWait flag (or something like that), which means that RunLD/ExecuteD will return only after closing the dialog.

    This entire magic with the Cleanup Stack is a bit strange, I think you may rather want to append the fields to the dialog object, then you would not have to keep them on the stack and do this swapping attempts, etc.

Similar Threads

  1. CAknEnumeratedTextPopupSettingItem
    By julie_777 in forum Symbian User Interface
    Replies: 1
    Last Post: 2011-08-24, 13:38
  2. CAknEnumeratedTextPopupSettingItem
    By lubom in forum Symbian
    Replies: 2
    Last Post: 2011-03-05, 05:01
  3. About CAknEnumeratedTextPopupSettingItem
    By jinhuideyx@tom.com in forum Symbian
    Replies: 2
    Last Post: 2009-08-18, 07:06
  4. CAknEnumeratedTextPopupSettingItem default value
    By kayem in forum Symbian User Interface
    Replies: 7
    Last Post: 2008-07-17, 07:12
  5. CAknEnumeratedTextPopupSettingItem
    By rampe29 in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-08-14, 07:26

Posting Permissions

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