Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    3

    Unhappy Yet another listbox issue

    Hi, all.

    I see that there are numerous posts here about listboxes, but none of them seem to solve my problem.

    I'm trying to construct a listbox using a resource file, but my application crashes during construction of the resource. I just can't seem to figure out why. Tried everything just as the samples show. I think.

    My code:

    void CTBGuiContainerCall::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iCallListBox = new (ELeave)CAknSingleStyleListBox;
    //iCallListBox -> ConstructL( this );

    TResourceReader reader;
    CEikonEnv::Static() -> CreateResourceReaderLC( reader, R_TBGUI_CALL_MENU );
    iCallListBox -> ConstructFromResourceL( reader );
    iCallListBox -> SetContainerWindowL( *this );
    CleanupStack::PopAndDestroy();


    iCallListBox->ActivateL();
    SetRect( aRect );
    ActivateL();
    }

    The resource:

    //----------------------------------------------------
    //
    // r_tbgui_call_menu
    //
    //----------------------------------------------------
    //
    RESOURCE LISTBOX r_tbgui_call_menu
    {
    array_id = r_tbguilist_item_call;
    flags = EAknListBoxSelectionList;
    }


    //-----------------------------------------------------------------------------
    //
    // r_tbguilist_item_call
    // Items array for ListBox( Double )
    //
    //-----------------------------------------------------------------------------
    //
    RESOURCE ARRAY r_tbguilist_item_call
    {
    items =
    {
    LBUF
    {
    txt = qtn_akncalllist_on_hold;
    },
    LBUF
    {
    txt = qtn_akncalllist_patch_blind;
    }
    };
    }


    ----

    The code compiles, but when I try to run it in the emulator, it just terminates. If I comment out everything about the resource-construction, and just calls ConstructL() on the listbox, it works.
    If I debug the code in CodeWarrior, I get to the CreateResourceReaderLC-call.

    Anynone know what is the deal, here?

    Thanks,
    Lars

  2. #2
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Hi,

    Try to create the listbox after ConstrucL of the container is completed. I think the listbox is not able to create before your control is totally ready.

    So you need a kind of command handler there.

    [code]
    CTBGuiContainerCall* obj = CTBGuiContainerCall::NewL...
    obj->OpenListBox ();

    Br V

Posting Permissions

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