×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    91

    CAknRadioButtonSettingPage - How to create Radio Button Settings Page?

    Hi Friends

    I am trying to create a Radio Button Settings Page. I am using the following code.........

    /////////////// CPP file /////////////////////////
    CDesCArray* listArray = new(ELeave) CDesCArrayFlat(2);
    listArray->AppendL( _L("1\tBackup&quot );
    listArray->AppendL( _L("0\tRestore&quot );

    CAknRadioButtonSettingPage* syncModePage = new ( ELeave )CAknRadioButtonSettingPage(R_SYNC_LIST_OPTIONS_SYNCMODE, iSyncMode, listArray );

    syncModePage->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted);
    ////////////////////////////////////////////////////////////////

    /////////////// RSS File ///////////////////////////////////////
    RESOURCE AVKON_SETTING_PAGE r_sync_list_options_syncmode
    {
    number = EAknSettingPageNoOrdinalDisplayed;
    label = qtn_sync_list_options_syncmode_title;
    type = EEikCtChoiceList; //EEikCtOptionButton
    editor_resource_id = 0; //r_sync_options_syncmode;
    }
    ///////////////////////////////////////////////////////

    I am getting an exception on the line where I use ExecuteLD. Could someome please tell me whats the problem..........?

    Thanks

    Ashish

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    91

    RE: CAknRadioButtonSettingPag e - How to create Radio Button Settings Page?

    HI

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    5
    Hi,

    Did you succeed in using CAknRadioButtonSettingPage? And do you have some code to post?
    Well I used it, and radio buttons were showed but there is a strange memory leak in that class.

    Regards,
    Srecko

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    58
    Srecko, you said you see the radio buttons. Can you post the code which did it. My code fails at ExecuteLD as Ashish mentioned!. Are there any other ways like using a seletion dialog and allow only a single markable selection (I mean when you select an item, it unmarks any previously selected item!)

    I would be extremely thankful if someone can show a working example

    Thanks

    murali

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    1

    Re: CAknRadioButtonSettingPage - How to create Radio Button Settings Page?

    Please try this--
    .Rss
    RESOURCE LISTBOX r_setting_app_listbox
    {
    flags = EEikListBoxMultipleSelection;
    }


    RESOURCE AVKON_SETTING_PAGE r_rtsecmgr_prompt_setting_dialog
    {
    number = EAknSettingPageNoOrdinalDisplayed;
    label= "Radio Buttons";
    softkey_resource = R_AVKON_SOFTKEYS_OK_EMPTY;
    type = EAknSetListBox;
    editor_resource_id= r_setting_app_listbox;
    }

    and Implementation

    TInt PromptL(const TPromptData& aPromptData /*Body text*/)
    {
    CDesCArray* iSettingPageText = new(ELeave) CDesCArrayFlat(6);
    CleanupStack::PushL(iSettingPageText);

    HBufC* pOneShotOpt = NULL;
    HBufC* pOneShotDenyOpt = NULL;


    pOneShotOpt = iCoeEnv->AllocReadResourceLC(_L("Option1"));
    pOneShotDenyOpt = iCoeEnv->AllocReadResourceLC(_L("Option1"));


    iSettingPageText->AppendL(pOneShotOpt->Des());
    iSettingPageText->AppendL(pOneShotDenyOpt->Des());

    AknsUtils::SetAvkonSkinEnabledL (ETrue);

    CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage(R_RTSECMGR_PROMPT_SETTING_DIALOG, selIndex, iSettingPageText);
    dlg->ConstructL();

    HBufC* promptTitle = iCoeEnv->AllocReadResourceLC(R_RTSECMGR_PROMPT_TITLE);

    HBufC* body = NULL;
    HBufC* itemBuffer = NULL;

    // Here pass the string to display as body.. even u can ignore it

    body = iCoeEnv->AllocReadResourceLC(CAPABILITY_RESOURCEID[aPromptData.iCapability]);
    const CFont* editorFont=iEikonEnv->AnnotationFont();
    CArrayFixFlat<TInt>* lineArray = new (ELeave) CArrayFixFlat<TInt>( 1 );
    CleanupStack::PushL( lineArray );
    lineArray->AppendL (300);
    lineArray->AppendL (300);
    TBuf<256> wrappedString;
    AknTextUtils::WrapToStringL( body->Des(), *lineArray, *editorFont, wrappedString);
    CleanupStack::PopAndDestroy(lineArray);
    itemBuffer = HBufC::NewLC(promptTitle->Length() + wrappedString.Length() + 1);
    TPtr itemPointer = itemBuffer->Des();
    itemPointer.Format(KListBoxItemFormat, &wrappedString, promptTitle);
    dlg->SetSettingTextL(*itemBuffer);

    if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted))
    {
    // now catch the user selection an return it "ret"
    }

    CleanupStack::PopAndDestroy(iSettingPageText);
    return ret;
    }

Posting Permissions

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