Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor mubx2000's Avatar
    Join Date
    Aug 2005
    Posts
    364
    Hi m I have a list of vendor names stored in a dynamic array , I designed a form that have the following information:

    Customer Name:
    Store No#: Address:

    But I need also to Include on this form the following vendor list:
    Vendor Name:
    -Peter
    -Welson
    -Sally
    .
    .
    .,etc

    logically I think that I need to present the vendor names in (ListBox) so How I can include the list box on the form? If not possible how I present this data in list format ?
    I need to Use a list box because the user will select the vendor name from a list to do further process and inquires.

  2. #2
    Registered User vin2ktalks's Avatar
    Join Date
    Jul 2005
    Location
    Bengaluru, India
    Posts
    747
    In 2.x SDK check the Pop-up Field Example, it may help you out.

  3. #3
    Super Contributor vasant21's Avatar
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174
    hi

    Here is my example on preparing list box using file http://discussion.forum.nokia.com/fo...ad.php?t=77730


    I haven't tried to place list in form, so i can't tell you about that.


    Hope this helps.
    Regards,
    vasant.

  4. #4
    Regular Contributor mubx2000's Avatar
    Join Date
    Aug 2005
    Posts
    364
    Quote Originally Posted by vasant21
    hi

    Here is my example on preparing list box using file http://discussion.forum.nokia.com/fo...ad.php?t=77730


    I haven't tried to place list in form, so i can't tell you about that.


    Hope this helps.
    Regards,
    vasant.
    Thanks I'll try to test it now , and telling you later.

  5. #5
    Regular Contributor hendrawan.ashari's Avatar
    Join Date
    Nov 2006
    Location
    Brebes, Indonesia
    Posts
    129
    why not display all information in LIST ?
    http://blogehendrawan.blogspot.com - Kembangin symbian di Indonesia yukk....

  6. #6
    Regular Contributor mubx2000's Avatar
    Join Date
    Aug 2005
    Posts
    364
    Quote Originally Posted by hendrawan.ashari
    why not display all information in LIST ?
    It is Not Logic I need to display The Customer name and a list name for all vendors this customer deal with (Master Detail format).

  7. #7
    Super Contributor mayankkedia's Avatar
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146
    I am assuming you are assuing CAknForm, you can add the listbox in the resource file using something like this ->

    --------------------------
    RESOURCE DIALOG r_aknexform_text_field_dialog
    {
    flags = * Whatever Flags u desire* ;
    buttons = *Create your Button List and add it here;
    form = r_aknexform_text_field_form;
    }

    RESOURCE FORM r_aknexform_text_field_form
    {
    items =
    {
    DLG_LINE
    {
    type = EEikListBox;
    prompt = *Label for your form*;
    id = EListBoxId;
    itemflags = *If you want any*;
    control = LISTBOX
    {
    flags = *Whatever Flags u want*;
    array_id = r_demo_listbox_items;
    }
    }
    }
    }


    RESOURCE ARRAY r_demo_listbox_items
    {
    items =
    {
    LBUF { txt = "Whatever u want to add here"; },
    LBUF { txt = "Whatever u want to add here"; },
    LBUF { txt = "Whatever u want to add here"; }
    };
    }

    ----

    And then ofcourse if u want to access the listbox in your code u can always do something like..

    CEikListBox* myListBox = (CEikListBox*)Control(EListBoxId);

    and then use the listBox pointer to add/modify what u want progrmatically.

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

    Cheers

  8. #8
    Regular Contributor mubx2000's Avatar
    Join Date
    Aug 2005
    Posts
    364
    Quote Originally Posted by mayankkedia
    I am assuming you are assuing CAknForm, you can add the listbox in the resource file using something like this ->

    --------------------------
    RESOURCE DIALOG r_aknexform_text_field_dialog
    {
    flags = * Whatever Flags u desire* ;
    buttons = *Create your Button List and add it here;
    form = r_aknexform_text_field_form;
    }

    RESOURCE FORM r_aknexform_text_field_form
    {
    items =
    {
    DLG_LINE
    {
    type = EEikListBox;
    prompt = *Label for your form*;
    id = EListBoxId;
    itemflags = *If you want any*;
    control = LISTBOX
    {
    flags = *Whatever Flags u want*;
    array_id = r_demo_listbox_items;
    }
    }
    }
    }


    RESOURCE ARRAY r_demo_listbox_items
    {
    items =
    {
    LBUF { txt = "Whatever u want to add here"; },
    LBUF { txt = "Whatever u want to add here"; },
    LBUF { txt = "Whatever u want to add here"; }
    };
    }

    ----

    And then ofcourse if u want to access the listbox in your code u can always do something like..

    CEikListBox* myListBox = (CEikListBox*)Control(EListBoxId);

    and then use the listBox pointer to add/modify what u want progrmatically.

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

    Cheers
    Thanks for your comment , the design above is sutible for static type of list box ,as I stated befoe that I want to Get The Names Of The Vendor from the database any way I'll test It today and tell you the result when I finish testing thanks again for your help I'm apprecited.

  9. #9
    Super Contributor mayankkedia's Avatar
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146
    Hi,

    Yes in that case what you can do is..leave the resource array empty..create the array progrmatically and then append it to the textbox by doing something like this ->

    -----------------------
    TInt count; // Get the array size in this var..using your code
    CDesC16ArrayFlat* myArray = CDesC16ArrayFlat::NewL(count);
    CEikListBox* myListbox = (CEikListBox*)Control(EMyListBoxId);
    CTextListBoxModel* myListBoxModel = myListBox->Model();

    // Append what all u need to append to the myArray

    myListBoxModel->SetItemTextArray(myArray);
    --------------
    This should solve your problems...ofcourse make sure to take care of the Cleanupstack issues..as i have not pushed or popped anything in the code.


    Also check this link..it might be helpful

    http://discussion.forum.nokia.com/fo...hp/t-3616.html


    Cheers

  10. #10
    Regular Contributor hendrawan.ashari's Avatar
    Join Date
    Nov 2006
    Location
    Brebes, Indonesia
    Posts
    129
    want to Get The Names Of The Vendor from the database
    U can get the name vendor from your database and use
    yourArray->AppendL(yourVendorName); // yourVendorName must be sincrone with your list

    I wish help you.
    http://blogehendrawan.blogspot.com - Kembangin symbian di Indonesia yukk....

  11. #11
    Regular Contributor mubx2000's Avatar
    Join Date
    Aug 2005
    Posts
    364
    Thanks for you all It Works Fine.
    Last edited by mubx2000; 2006-11-11 at 11:21.

  12. #12
    Registered User mscheng's Avatar
    Join Date
    Nov 2006
    Posts
    23
    I use code as following:

    CEikListBox* myListBox = (CEikListBox*)Control(ESelectionListControl);
    CTextListBoxModel* myListBoxModel = myListBox->Model();
    myListBoxModel->SetItemTextArray(array);


    but, error occur as following:

    1.undefined identifier 'Control';
    2.illegal implicit conversion from 'MListBoxModel *' to 'CTextListBoxModel *'

    Thanks!

    Adrian

  13. #13
    Super Contributor Priju Jacob Paul's Avatar
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156
    Quote Originally Posted by mscheng
    I use code as following:
    CEikListBox* myListBox = (CEikListBox*)Control(ESelectionListControl);
    CTextListBoxModel* myListBoxModel = myListBox->Model();
    myListBoxModel->SetItemTextArray(array);[/I]

    but, error occur as following:

    1.undefined identifier 'Control';
    2.illegal implicit conversion from 'MListBoxModel *' to 'CTextListBoxModel *'
    1)i dont find a function named Control() in the class CEikListBox atleast in the public sdk.

    2) i guess you need to use something like this.

    Code:
    CDesCArray* array = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
    Priju

  14. #14
    Super Contributor mayankkedia's Avatar
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146
    That code should have worked...I will check it out..u could also try something like this then :-

    ----
    // get listbox item array

    MDesCArray* textArray = list->Model()->ItemTextArray();

    CDesCArray* itemList = static_cast<CDesCArray*>(textArray);

    // construct new item, build

    _LIT(KNewItem, "New item..");

    TBuf<32> item;

    item.Format(_L("\t%S\t\t"), &KNewItem);

    // append new item to the listbox

    itemList->AppendL(item);

    // update listbox

    list->HandleItemAdditionL();
    ------------

    This would work just fine in your case..and instead of that one item that has been added in the code..u can put a for loop or something and keep adding the contents till u have them..and then call handleitemaddition at the end of it..to update and redraw the listbox.

    Cheers
    mayank

Similar Threads

  1. Displaying Information In a form from Listbox Item
    By mubx2000 in forum Symbian C++
    Replies: 7
    Last Post: 2006-10-07, 07:53
  2. display form on click of listbox item
    By Kapil Kaushik in forum Symbian C++
    Replies: 0
    Last Post: 2006-03-16, 09:38
  3. Listbox & Form
    By tukaram in forum Symbian C++
    Replies: 1
    Last Post: 2005-06-28, 05:24
  4. Tryin to switch from listbox to form in same container
    By advocatee in forum Symbian C++
    Replies: 1
    Last Post: 2003-07-18, 04:05
  5. Adding a listbox to a form 'pages' resource?
    By advocatee in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-07-08, 15:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved