×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    12

    CAknDoubleStyleListBox Problems

    Hi all,

    I recently created a derived class for CAknSingleStyleListBox, and all was fine the app would boot and i could veiw the list.

    However due to a change in my requirements i am now required to do what at first seemed a simple change, namely to display a CAknDoubleStyleListBox instead.

    My altered code for my class looks something like:

    Code:
    class MyListBox : public CAknDoubleStyleListBox 
    {
    	public:
    	   MyListBox (CConfig *aConfig);
    	   virtual ~MyListBox ();
    
    	protected:
    	   virtual void CreateItemDrawerL();
    	   CConfig *iConfig;   
    };

    and it is created via:

    Code:
    iPhoneNumberListBox = new (ELeave) MyListBox(iConfig);	
    iPhoneNumberListBox->ConstructL(this, 0); 
    iPhoneNumberListBox->SetContainerWindowL(*this);
    iPhoneNumberListBox->SetListBoxObserver(this);	   
    iPhoneNumberListBox->CreateScrollBarFrameL(ETrue);  iPhoneNumberListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
    iPhoneNumberListBox->MakeVisible(ETrue);
    However unlike the code using the CAknSingleStyleListBox this fails at the iPhoneNumberListBox->ConstructL(this, 0) line with a KERN-EXEC 3, this i beleive is a NULL pointer style error (although i'm not sure).

    So if anyone could shed some light in the differnces between the two classes that could be causing this and whether it is a NULL pointer error i am seeing i would be most appreciative.

    Many thanks for your time and patience

    Osprey

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    15

    Re: CAknDoubleStyleListBox Problems

    You must also change the .rss resource files according to your needs. CAknDoubleStyleListBox will look for that resources and i think you're trying to work with the old resource file that you used with CAknSingleStyleListBox.

  3. #3
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: CAknDoubleStyleListBox Problems

    Hi,

    I faced the same problem previously. If I'm not mistaken, CAknSingleStyleListBox is using CAknColumnListBox but CAknDoubleStyleListBox is using CEikFormattedCellListBox. Maybe you should into it.


    Hope it can help ;)
    Regards,
    Nini

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    12

    Re: CAknDoubleStyleListBox Problems

    Many thanks for the suggestions, I have finally got the box to display itself (it was the CEikFormattedCellListBox class i should have been using, many thanks ninidotnet).

    However i do now have another issue with the class, how to format the text within the indivdual items into two columns.

    currently i am obtaining the text for the item via:

    Code:
    TBuf<128> itemText;
    	itemText.Append(iModel->ItemText(aItemIndex));
    	itemText.TrimLeft();
    Ths is then formatted and drawn via:

    Code:
    	TListItemProperties font;
    		font.SetBold(ETrue);
    		font.SetColor(KRgbBlack);
    		font.SetDimmed(EFalse);
    		font.SetItalics(EFalse);
    		CFont* fontUsed = ColumnData()->Font(font,0);
    
    		TRgb orange = TRgb(244,164,96);
    		
    		iGc->UseFont(fontUsed);
    		iGc->SetBrushColor(orange);
    
    		TPoint topleft(aActualItemRect.iTl.iX+10, aActualItemRect.iTl.iY);
    		TRect  highlighted(topleft, aActualItemRect.iBr);
    		TInt baseline = (aActualItemRect.Height() - fontUsed->HeightInPixels()) / 2 + fontUsed->AscentInPixels();
            
            iGc->DrawRect(aActualItemRect);                        
            iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
            iGc->DrawText(itemText, highlighted, baseline);
    All of this is within the DrawActualItem method of the extended CFormattedCellListBoxItemDrawer class.

    Now the problem is that this displays the text as one line, i.e.

    Bob'\t'000000000000

    exactly as the text is returned.

    My question is, is there a way to retreive the text for the individual columns or set the text in the individual columns so that i obtain a format more like:

    Bob
    00000000000

    in each cell. I have looked through the API's and tried googling this subject but i am having trouble finding the information i need to solve this, so any illumination that can be provided would be appreciated.

    Many thanks again for your time and patience.

    Osprey

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: CAknDoubleStyleListBox Problems

    Try appending
    Code:
    \tBob\t000000000000
    it should work.
    Code:
    void CBlahAppView::ConstructL(const TRect& aRect)
    {
        CreateWindowL();
        iListBox=new(ELeave)CAknDoubleStyleListBox;
        iListBox->ConstructL(this,EAknListBoxSelectionList);
        iListBox->SetContainerWindowL(*this);
        SetRect(aRect);
        ActivateL();
    }
    
    _LIT(KFormat,"\tItem\t%d");
    void CBlahAppView::UpdateListBoxModelL()
    {
        TBuf<100> buf;
        CDesCArray *array=(CDesCArray*)iListBox->Model()->ItemTextArray();
        for(TInt i=0;i<10;i++)
        {
            buf.Format(KFormat,++iItemNo);
            array->AppendL(buf);
        }
        iListBox->HandleItemAdditionL();
    }

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    35

    Re: CAknDoubleStyleListBox Problems

    hi Osprey...
    I am facing a problem like u...

    i m using CAknSingleStyleListBox after derived it showing KERN-EXEC 3...error

    Would u plz help me
    ABC

Similar Threads

  1. Several problems with NMIT 4.1 MMS
    By jtalviva in forum General Messaging
    Replies: 0
    Last Post: 2006-03-10, 11:03
  2. Several problems with NMIT 4.1
    By jtalviva in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2006-03-10, 10:59
  3. Problems with Nokia carkit CK-1W
    By Batunas in forum General Development Questions
    Replies: 1
    Last Post: 2004-02-09, 18:18
  4. general problems in 3410
    By fredgauchet in forum Mobile Java General
    Replies: 1
    Last Post: 2002-08-26, 14:38

Posting Permissions

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