×

Discussion Board

Results 1 to 6 of 6

Thread: Double List??

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    22

    Unhappy Double List??

    Hello genius out there!

    I have a small problem:

    I want to create a double-item listbox from some strings.

    Please help me out.

    The string will come from a socket.

    eg. "(Message1,hello)Message2,hi)"

    and the final list code should be

    [(u"message1",u"hello"),(u"Message2",u"hi")]

    and will be displayed in a listbox.

    Please help me out!

    Thank you!

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: Double List??

    Hi darklord18,
    I hope I got your question correctly, please see this link for listbox,

    http://www.mobilenin.com/pys60/resou...ody_listbox.py
    IDEAS is all they need but still they think only Genius can give them that.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    22

    Unhappy Re: Double List??

    Thank you a lot for the reply, but i didnt meant that!I need two row(one for the name and the other for the detail). You can achieve this by writing this!

    entries = [(u"Signal",u"Battery"),(u"asd","asd")]

    This will give a two rowed listbox.

    Ok let me simplify to help you.

    I need a code that will change a string to this format:

    the string:
    liststring= "Signal,Battery:asd,asd"

    It will first split it.

    making it become
    Signal,Battery and asd,asd

    Then make the Signal and the battery in the same bracket with its unicode as shown below.

    [(u"Signal",u"Battery"),(u"asd",u"asd")]

    instead of

    [(u"Signal",u"Battery",u"asd",u"asd")]

    try to help me plz!

    Thank you a lot!

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Double List??

    This should work:

    Code:
    liststring="Signal,Battery:asd,asd"
    
    #Make it unicode
    liststring=unicode(liststring)
    
    #Split the two parts
    a=liststring.split(":")
    
    #Split the elements in the two parts
    p1=a[0].split(",")
    p2=a[1].split(",")
    
    #Create two empty list to which we will append the elements, and then make tuples out of them
    b1=[]
    b2=[]
    
    for i in p1:
    	b1.append(i)
    for i in p2:
    	b2.append(i)
    
    final=[tuple(b1),tuple(b2)]
    #Should return [(u'Signal', u'Battery'), (u'asd', u'asd')]

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    22

    Smile Re: Double List??

    Hi! THANK YOU A LOT!!

    It works!

    I also found another code(if that may help other people):
    (#)

    data="Data1:helloata2:hiata3:heil"
    as=unicode(data)
    li=as.split(":")
    global msg
    msg=[ ]
    en=0
    for j in li:
    if en==0:
    a=j
    en=1
    else:
    y=j
    first=a,y
    msg.append(first)
    en=0
    app1 = appuifw.Listbox(msg, handler)


    (#)
    This will give you the list!

    THANK YOU A LOT!!

    You people doing a GREAT joB!
    Last edited by darklord18; 2008-06-14 at 14:51.

  6. #6
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Talking Re: Double List??

    Quote Originally Posted by darklord18 View Post
    data="Data1:helloata2:hiata3:heil"
    Looks funny - Code with smilies.

    Please use the CODE tabs (#) while posting some CODE.

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

Similar Threads

  1. List box - Series 80 - icon + text + double lines
    By k e k s in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-02, 10:49
  2. List: Simple line or double line
    By Pepper_91 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-10-02, 16:04
  3. How to add items dynamically to the double pop menu style list box
    By vinayakak in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-12-07, 08:16
  4. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  5. Use Jpg instead of MBm for Double List Box
    By XciteZ in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-08-03, 05:10

Posting Permissions

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