×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    Poland, Lodz
    Posts
    6

    How to create Listbox with items with additional text(date) to the right

    I have Nokia E50.
    In Messaging I've created a new message and saved it in Drafts. Now when open Drafts I see a Listbox with items in this format:
    Code:
    ------------------------
    |icon Text1            |
    |     Text2      [date]|
    ------------------------
    How to create Listbox with items with additional text(date) to the right? Now I am using CAknDoubleGraphicStyleListBox and format "0\tText1\tText2\t", but there is no possibility (I think so) to add date to the right.

    Thanks

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to create Listbox with items with additional text(date) to the right

    Quote Originally Posted by stargate88 View Post
    I have Nokia E50.
    In Messaging I've created a new message and saved it in Drafts. Now when open Drafts I see a Listbox with items in this format:
    Code:
    ------------------------
    |icon Text1            |
    |     Text2      [date]|
    ------------------------
    How to create Listbox with items with additional text(date) to the right? Now I am using CAknDoubleGraphicStyleListBox and format "0\tText1\tText2\t", but there is no possibility (I think so) to add date to the right.

    Thanks
    stargate88-Hello,

    you can show date in rightside of listbox CAknDoubleGraphicStyleListBox item..add date in the form of string in second text2..and you can get date by
    this way....Now format "0\tText1\tText2[dateToStr]\t",
    TBuf<256> dateToStr;
    TTime time;
    TDateTime dateTime;
    // Get current local time,
    time.HomeTime();

    // Convert to fields
    dateTime=time.DateTime();

    GetDateInStr(dateToStr,dateTime);

    void GetDateInStr(TDes& aStr,TDateTime aDateTime)
    {
    _LIT(KDateTxt,"%d. %d. %d ");
    aStr.Format(KDateTxt, aDateTime.Year(),TInt(aDateTime.Month()+1),
    aDateTime.Day()+1 );
    }


    I hope, It would be helpful for you.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Location
    Poland, Lodz
    Posts
    6

    Re: How to create Listbox with items with additional text(date) to the right

    Thanks kis_spn :)
    but this not works for me. If I use format "0\tText1\tText2[Text3]\t" I see something like this
    Code:
    ------------------------
    |icon Text1            |
    |     Text2[Text3]     |
    ------------------------
    and Text3 is not in rightside.
    I need
    Code:
    ------------------------
    |icon Text1            |
    |     Text2       Text3|
    ------------------------
    I need to put date in Text3, but this is not something with which I am fighting ;)
    And in my opinion hardcoded date is not a good idea. I think better code is
    Code:
    #include <avkon.rsg>
    
    TBuf<20> stringDate;
    TTime date = GetDateSomehow();
    HBufC * dateFormat = StringLoader::LoadLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO );
    date.FormatL( stringDate, *dateFormat );

  4. #4
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: How to create Listbox with items with additional text(date) to the right

    Quote Originally Posted by stargate88 View Post
    Thanks kis_spn :)
    but this not works for me. If I use format "0\tText1\tText2[Text3]\t" I see something like this
    Code:
    ------------------------
    |icon Text1            |
    |     Text2[Text3]     |
    ------------------------
    and Text3 is not in rightside.
    I need
    Code:
    ------------------------
    |icon Text1            |
    |     Text2       Text3|
    ------------------------
    I need to put date in Text3, but this is not something with which I am fighting ;)
    And in my opinion hardcoded date is not a good idea. I think better code is
    Code:
    #include <avkon.rsg>
    
    TBuf<20> stringDate;
    TTime date = GetDateSomehow();
    HBufC * dateFormat = StringLoader::LoadLC( R_QTN_DATE_WITHOUT_YEAR_WITH_ZERO );
    date.FormatL( stringDate, *dateFormat );
    I dont think so..because you can appened date text in text2 by using Descriptor Appened function.....once again you try...

  5. #5
    Registered User
    Join Date
    Jul 2007
    Location
    Poland, Lodz
    Posts
    6

    Re: How to create Listbox with items with additional text(date) to the right

    Leave alone this date, please. I only need some rightaligned text. I am sure, that this is possible.

  6. #6
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    98

    Re: How to create Listbox with items with additional text(date) to the right

    Hi,

    Probably you would need to customize CEikColumnListBox(or CAknColumnListBox?) class by yourself.
    Then you'd be free to decide the layout. I don't know if there is any easier way to achieve it.
    Last edited by mimimi; 2007-09-17 at 09:10.

  7. #7
    Regular Contributor
    Join Date
    Sep 2006
    Location
    Helsinki
    Posts
    109

    Re: How to create Listbox with items with additional text(date) to the right

    I'm not sure, if you can make this to work, I haven't tried to manipulate subcell propertiess of predefined Avkon lists, but give it a try:

    Call this in appropriate places, I think at least everytime SetRect/SetSize is called for listbox

    Code:
    TInt dateSubcellIndex = 3; 
    iList->ItemDrawer()->FormattedCellData()->SetSubCellAlignmentL(dateSubcellIndex,  CGraphicsContext::ERight);
    If you can't make it work, best option is to implement your own listbox using CEikFormattedCellListBox. It takes some learning, but you can position subcells of single list item quite freely and manipulate all properties that you see CEikFormattedCellListBoxData.
    Teemu Kurppa
    Blog: http://dirtyaura.org/blog

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    18

    Re: How to create Listbox with items with additional text(date) to the right

    Quote Originally Posted by teemukurppa View Post
    I'm not sure, if you can make this to work, I haven't tried to manipulate subcell propertiess of predefined Avkon lists, but give it a try:

    Call this in appropriate places, I think at least everytime SetRect/SetSize is called for listbox

    Code:
    TInt dateSubcellIndex = 3; 
    iList->ItemDrawer()->FormattedCellData()->SetSubCellAlignmentL(dateSubcellIndex,  CGraphicsContext::ERight);
    If you can't make it work, best option is to implement your own listbox using CEikFormattedCellListBox. It takes some learning, but you can position subcells of single list item quite freely and manipulate all properties that you see CEikFormattedCellListBoxData.

    Yes, you are right. Extra field (i.e. listbox's column/cell), whether it's text or graphics, can be setup using the API of CFormattedCellListBoxData. I'd suggest selecting AVKON listbox class, which layout is closest to your desired one and then setup extra field for this one.

    If you look at all the CAkn*ListBox classes, then CAknDouble2GraphicLargeGraphicStyleListBox seem to have most predefined item cells (6 cells) looking at its item string format:

    "0\t1\tFirstLabel\tSecondLabel\t2\t3"

    Therefore I'd suggest, to be on safe side (not conflicting with any of existing listbox layouts), the following:

    Code:
    TInt dateSubcellIndex = 6;

Similar Threads

  1. Replies: 5
    Last Post: 2008-06-03, 06:32
  2. How to create ListBox from Resource File?
    By jennie in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-08-31, 09:59
  3. Replies: 3
    Last Post: 2007-08-13, 15:19
  4. Remove items from a listbox
    By kaiten-sushi in forum Symbian User Interface
    Replies: 18
    Last Post: 2007-02-21, 14:33
  5. Replies: 1
    Last Post: 2003-10-23, 15:17

Posting Permissions

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