×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    Can someone check my multi select list code?

    PLEASE HELP!!!! My Listbox hasn't appeared for weeks!!!! I really need it to work.. someone pls help check my code?

    I've been trying for weeks to implement the multiple selection list
    I've created the mbm file.

    I have DisplayListBoxL() which is called by my container's ConstructL().

    Following is the important code:-----------------------------------------------------------------------------------

    mmp file: LIBRARY eikctl.lib

    Container Source Code:---------------------------------------------------------------------------------------------
    #include "TestListContainer.h"
    #include <aknlists.h>
    #include "testlist.rsg"
    #include "barsread.h"
    #include <akniconarray.h>
    #include <testlist.mbg>
    #include <eikclbd.h>

    void CTestListContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetRect(aRect);
    ActivateL();
    User::InfoPrint(_L("ConstructL"));
    DisplayListBoxL();
    }

    void CTestListContainer::DisplayListBoxL()
    {

    if (iListBox)
    {
    delete iListBox;
    iListBox = NULL;
    }


    User::InfoPrint(_L("DisplayListBoxL"));
    //iListBox = new (ELeave) CAknSingleStyleListBox();
    //TInt resourceId = R_F2F_LIST_1;
    iListBox = new (ELeave) CAknSingleGraphicStyleListBox();
    TInt resourceId = R_F2F_SINGLE_GRAPHIC_MULTI;
    iListBox->SetContainerWindowL(*this);

    TResourceReader reader;
    CEikonEnv::Static()->CreateResourceReaderLC(reader, resourceId);

    iListBox->ConstructFromResourceL(reader);
    CleanupStack::PopAndDestroy();

    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
    CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );




    //********************START ICON PART********************************

    CArrayPtr<CGulIcon>* icons = new( ELeave ) CAknIconArray( KGraphicGulIconIndex ); //10
    CleanupStack::PushL( icons );

    //********************START APPEND ICONs PART********************************
    // Appends icon.
    icons->AppendL( iEikonEnv->CreateIconL( KMbmFileName,
    EMbmTestlistCheck,
    EMbmTestlistCheckm ) );

    icons->AppendL( iEikonEnv->CreateIconL( KMbmFileName,
    EMbmTestlistNon_check,
    EMbmTestlistNon_checkm ) );
    //********************START APPEND ICONs PART********************************

    // Sets graphics as ListBox icon.
    iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
    CleanupStack::Pop();

    //********************END ICON PART********************************


    iListBox->SetListBoxObserver(this);
    iListBox->SetObserver(this);
    //SizeChanged();//will crash

    iListBox->ActivateL();

    DrawNow();
    }


    -----------------------------------------------------------------------------------------------------------------------------
    Here is my resource file, which states the multiselectionlist flag.

    RESOURCE LISTBOX r_f2f_single_graphic_multi
    {
    array_id = r_f2f_list_1_array;
    flags = EAknListBoxMultiselectionList;
    }

    -------------------------------------------------------------------------------------------------------------------------

    The application runs fine and doesn't crash. But no list shows. And the screen remains the default grey.

    If i uncomment SizeChanged() near the end of the DisplayListBoxL() function the application will crash, while the screen is white.

    HELP!!!!!
    Last edited by advocatee; 2003-08-17 at 21:39.

  2. #2
    Registered User
    Join Date
    May 2003
    Location
    France
    Posts
    22
    Perhaps you missed to call ConstructL() on your listbox?

  3. #3
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    Thanks, but...

    Im not sure bout that

    None of the listboxes i've ever used, which include singlestyle lists and settinglists, require an explicit call to the listbox's ConstructL.

    Besides, i'm doing this based on the AKNEXLIST example. And there's no listbox constructL anywhere to be seen.

    You can see this app used to have a CAknSingleStyleListBox();

    //iListBox = new (ELeave) CAknSingleStyleListBox();
    //TInt resourceId = R_F2F_LIST_1;
    iListBox = new (ELeave) CAknSingleGraphicStyleListBox();
    TInt resourceId = R_F2F_SINGLE_GRAPHIC_MULTI;

    When i uncomment the first 2 lines and comment the 3rd and 4th line,

    and comment all the icon/graphic codes

    and i uncomment
    //SizeChanged();//will crash
    which is somewhere at the bottom of the code,

    The CAknSingleStyleListBox() WILL SHOW FINE! it shows!

    Unfortunately the multi selection list CAknSingleGraphicStyleListBox does not show.

    somehow when i uncomment SizeChanged() when trying CAknSingleGraphicStyleListBox the thing will crash. If not, then the list won't show. =p

    well, yea i'm longwinded.
    Last edited by advocatee; 2003-08-18 at 08:03.

  4. #4
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    Okok forget that crap...

    I just did something funny .

    i tried doing this instead of a CAknSingleGraphicStyleListBox:

    iListBox = new (ELeave) CAknSingleStyleListBox();

    i changed its resource into a EAknListBoxMultiselectionList....

    I left the icon/graphic related code uncommented.

    Tada,

    I get a CAknSingleStyleListBox, that displays a monochrome version of the icons, ONLY when i click 'ok' on a list item. clicking again will cause the icon to disappear. So effectively i'm only seeing 1 of the 2 icons. And the icon appears on the right side of the list!

  5. #5
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    Does someone have a small sample for the multiple selection listbox ?

    The AKNEXLISTBOX is too complexed..

    I need to get it done urgently...... =(

    Thanks

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    27
    Try to change the graphic style list box from CAknSingleStyleListBox to CAknDoubleLargeStyleListBox derived from CEikFormattedCellListBox.Follow the pattern to append data from the book.I think it will work

  7. #7
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    what book are u refering to? hahahah

  8. #8
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    okay i tried CAknDoubleLargeStyleListBox,

    still nothing appears. Gray screen

    And it still crashes when i uncomment the SizeChanged().

    Unusual that any other list other than SingleStyleList will crash with SizeChanged.

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    27
    Book is:Programming for the Series 60 Platform and Symbian OS.
    Application is crashing only because you are not appending data to the listbox in the format it is supposed to be appended.Here's my code.AND IT WORKS.
    void CWVCContainer4::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("Available Users") );

    //create instance of the listbox
    iListBox= new (ELeave) CAknDoubleLargeStyleListBox;
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this,EAknListBoxSelectionList);

    //create Scrollbars for this listbox
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,CEikScrollBarFrame::EAuto);

    //to add data to this listbox
    CDesCArray* array= new (ELeave) CDesCArrayFlat(10);
    CleanupStack::PushL(array);
    array->AppendL(_L("0\taaa\tbbbb\t"));
    array->AppendL(_L("1\tcccc\tcccc\t"));
    array->AppendL(_L("0\eeee\ftfff\t"));
    array->AppendL(_L("1\gggg\hhhh\t"));
    array->AppendL(_L("0\tiiii\jjjj\t"));
    array->AppendL(_L("1\kkkk\llll\t"));
    array->AppendL(_L("0\tmmmm\nnnn\t"));
    array->AppendL(_L("1\oooo\pppp\t"));
    CleanupStack::Pop(); //array
    // iListBox->Model()->SetItemTextArray(array);

    //to create pointer array for the icons
    CArrayPtr<CGulIcon>* icons=new (ELeave)
    CArrayPtrFlat<CGulIcon>(1);
    CleanupStack::PushL(icons); // PUSH Icon

    //to set the icon array
    iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(icons);

    //to append the icons
    icons->AppendL(iEikonEnv->CreateIconL(
    _L("Z:\\system\\apps\\wvc\\listicons.mbm"),0,
    0));

    icons->AppendL(iEikonEnv->CreateIconL(
    _L("Z:\\system\\apps\\wvc\\listicons.mbm"),1,
    1));

    iListBox->Model()->SetItemTextArray(array);
    CleanupStack::Pop(); // POP Icon

    SetRect(aRect);
    ActivateL();
    }

  10. #10
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318

    =)))

    oh that book. I was tryin to get it a long time ago. Not available where i am tho.. very xpensive to buy it online.

    Thanks a zillion for the code.
    i'll try it out and post my results.

  11. #11
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    i'm getting this

    C:\SYMBIAN\6.1\SERIES60\KEVSAPPS\TESTLIST\SRC\Testlistcontainer.cpp(56) : warning C4129: 'e' : unrecognized character escape sequence

    kind of warning for line of this:

    array->AppendL(_L("0\taaa\tbbbb\t"));
    array->AppendL(_L("1\tcccc\tcccc\t"));
    array->AppendL(_L("0\eeee\ftfff\t"));
    array->AppendL(_L("1\gggg\hhhh\t"));
    array->AppendL(_L("0\tiiii\jjjj\t"));
    array->AppendL(_L("1\kkkk\llll\t"));
    array->AppendL(_L("0\tmmmm\nnnn\t"));
    array->AppendL(_L("1\oooo\pppp\t"));

    Also 2 errors:
    TESTLISTCONTAINER.obj : error LNK2001: unresolved external symbol "public: void __thiscall CDesC16Array::AppendL(class TDesC16 const &)" (?AppendL@CDesC16Array@@QAEXABVTDesC16@@@Z)
    TESTLISTCONTAINER.obj : error LNK2001: unresolved external symbol "public: __thiscall CDesC16ArrayFlat::CDesC16ArrayFlat(int)" (??0CDesC16ArrayFlat@@QAE@H@Z)
    \Symbian\6.1\Series60\EPOC32\BUILD\SYMBIAN\6.1\SERIES60\KEVSAPPS\TESTLIST\GROUP\TESTLIST\WINS\UDEB\TESTLIST.APP : fatal error LNK1120: 2 unresolved externals

    What header files or libraries am i missing? Or is that not the case?

    Thanks again santoshudipi

    - aDvo 0

  12. #12
    Registered User
    Join Date
    Jul 2003
    Posts
    27
    You r very close to the final step
    I think I missed /t in the AppendL statements.Pls use/t wherever I have written /.
    Also for the Linker error you need to include bafl.lib library in mmp file.I too had this problem .Someone has also posted this solution over the forum

  13. #13
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    Alright its working

    Sorry to carry this on for so long,,

    I think this would be my final questions. I admit i'm not very good at symbian programmin.

    1) It seems to me that this list is not a multiple selection list. Can this list be made into such a list?
    In a multiple selection list, clicking on a list item causes it to alternate between 2 sets of graphics as far as i know (checked+checkedmask) and (unchecked+uncheckedmask).

    2) How come my icons, which are actually coloured , are displayed monochrome (black and white)?

    Now i'm wishing i had that book.

    - aDvo -

  14. #14
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    I notice there is a
    "Multi-Selection List" section
    under
    chapter 10 Lists and List Types

    well, lookin at the digia home page =P

    is that where ur code came from?

  15. #15
    Registered User
    Join Date
    Jul 2003
    Posts
    27
    The code was partly from that book.But,to be very frank the combination of the book and the SDK help has taken me deep into a maze which I feel I need to come out.
    Pls try out all the programs on your own.

Posting Permissions

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