×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    changing format of selected row in CAknSingleGraphicStyleListBox

    hi,

    i am showing all records of contact database in a CAknSingleGraphicStyleListBox

    when a user clicks on any row the record of that row is written in a file

    and each time i read the records from file and and match it with all records in the listbox. when the records match i show an icon. otherwise a blank icon. (in my function CreateListL).

    if(flag==0)
    nameBuf4.Format(_L("0\t%S"),&namefield); ------blank icon
    else
    nameBuf4.Format(_L("1\t%S"),&namefield);-------icon

    now the problem is that when the user clicks on any of the rows i have to call my function CreateListL so that the format is set and i can display the icons.

    this is very lengthy process. is there any way to change the format of current row (i have the current index) so that i don't have to do all matching again and again.

    i tried may things but was not successful.

    thanks
    sunny

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: changing format of selected row in CAknSingleGraphicStyleListBox

    just get the item array by doing something like this:

    MDesCArray* itemList = iAddBox->Model()->ItemTextArray();
    CDesCArray* itemArray = STATIC_CAST( CDesCArray* ,itemList )

    then delete the current line and add new to that same position:

    itemArray->Delete(aItem);
    itemArray->InsertL(aItem,NewItemBuf->Des());

    then just draw the selected item again:

    iAddBox->View()->DrawItem(aItem);

    yucca

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    Re: changing format of selected row in CAknSingleGraphicStyleListBox

    hi yucca,
    thanks very much your code worked perfectly. but i also wanted the data of the current index. i have done it in this way.

    CTextListBoxModel *model = iMyListBox->Model();
    TBuf<270> nameBuf2;
    TBuf<270> nameBuf4;
    nameBuf2.Copy(model->ItemText(ListIndex));//-- read data with
    //format
    nameBuf2.Delete(0,2); //-- delete 2 characters of format

    nameBuf4.Format(_L("1\t%S"),&nameBuf2); //-- give new format
    itemArray->Delete(ListIndex);
    itemArray->InsertL(ListIndex,nameBuf4);
    is it ok or is there any another feasible way to do it.

    thanks
    regards
    sunny

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: changing format of selected row in CAknSingleGraphicStyleListBox

    if it works, it should be ok. Anyway, best way to parse columns out from the listbox string would be to use TextUtils and ColumnText function of it. It's documented in the SDK, so have a look and see if you like to use it.

    yucca

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    Re: changing format of selected row in CAknSingleGraphicStyleListBox

    thanks yucca,

    there is one more small problem. i have creted a findbox also but when i type a letter (say 'a') it serches for it after each space.

    for eg:
    i type -> a
    it shows :
    aa
    jj asd
    kk dd a
    i don't want the next two lines.

    i am making the findbox in this way

    // in my ConstructL----creating findbox
    iFindBox = CreateFindBoxL(iMyListBox, iMyListBox->Model(),
    CAknSearchField::EPopup );
    iFindBox->MakeVisible( ETrue );
    iFindBox->SetFocus(ETrue);
    iFindBox->ActivateL(); // activate Find box.


    //my function
    CAknSearchField* CMultiViewsContainer2::CreateFindBoxL(CEikListBox* aListBox,CTextListBoxModel* aModel,CAknSearchField::TSearchFieldStyle aStyle )
    {
    CAknSearchField* findbox = NULL;

    if ( aListBox && aModel )
    {
    // Gets pointer of CAknFilteredTextListBoxModel.
    CAknFilteredTextListBoxModel* model = STATIC_CAST(
    CAknFilteredTextListBoxModel*, aModel );
    // Creates FindBox.
    findbox = CAknSearchField::NewL( *this, aStyle, NULL,
    KAknExListFindBoxTextLength );
    CleanupStack::PushL(findbox);
    // Creates CAknListBoxFilterItems class.
    model->CreateFilterL( aListBox, findbox );

    //Filter can get by model->Filter();
    CleanupStack::Pop(findbox); // findbox
    }
    return findbox;
    }

    i have tried all sorts of things but all in vain. maybe you could help me.

    thanks
    sunny

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: changing format of selected row in CAknSingleGraphicStyleListBox

    I have to say that I have always been happy with the default behaviour, so haven't got any interest on changing it. anyway, it can really be hard to make some Akn controls to behave anything else than what was designed for them, so sorry, but can not be help on this one.

    yucca

Similar Threads

  1. Replies: 0
    Last Post: 2005-10-15, 06:49
  2. ????????Convert Date format
    By mehulgarnara in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-04-15, 07:34
  3. Nokia6600 vs TYPE_USHORT_565_RGB Pixel Format..
    By Niall in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2003-09-16, 12:07
  4. getting selected items from CAknSingleGraphicStyleListBox
    By advocatee in forum Symbian User Interface
    Replies: 14
    Last Post: 2003-09-01, 22:02

Posting Permissions

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