×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    11

    getting problem wth multi selection list

    Hi,

    I'm getting some problem in multi selection list. I'm working on files to get data. I have two functions save_list() and load_list(). When I'm loading data from file using load_list() into multi selection list then it is showing that there is no data. On the other hand if I'm printing it using print command, it is printing List.

    My code is following:

    Code:
    mylist = [u"Mobile",u"Python"]
    save_list(u"c:\\mydata.txt",mylist)
    
    
    newlist = load_list(u"c:\\mydata.txt")
    choices = appuifw.multi_selection_list(newlist,'checkbox',1)
    How can I resole this problem.

    Waiting for your kind reply.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: getting problem wth multi selection list

    Hi furqanraza
    i think if you are loading something from the file that means you are reading something from the file.
    So first you have to open the file and then read it then probably use that in multi_selectionlist.

    Hope you got the point
    Enjoy Pythoning
    Gaba88

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    11

    Re: getting problem wth multi selection list

    yes I'm doing the same thing. It is the functionality of load_list() function to open the file. Here is code:

    Code:
    def load_list(filename):
       myfile = file(filename,"r")
       lst = []
       for line in myfile:
          lst.append(line.strip())
       myfile.close()
       return lst
    
    def save_list(filename,lst):
       myfile = file(filename,"w")
       for item in lst:
          print >> myfile, item
       myfile.close()
    consder an example,

    suppose there is a data [u"Mobile",u"Python"] in mydata.txt

    now,

    Code:
    list = load_list(u"c:\\mydata.txt")
    if I'll write

    Code:
    print list
    then it is printing the list ['Mobile','Python']

    If I assign this list to multi_selection_list then it is showing that "No Data"


    Now, tell me how can I solve it?

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: getting problem wth multi selection list

    Hi furqanraza
    i am not sure but i think you cant pass functions or objects in the multiselsction list but i may be wrong investigating with the code just wait will be back.

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    11

    Re: getting problem wth multi selection list

    but load_list function is retuning a LIST and even it is printing successfully. While I'm passing LIST into multi_selection_list, it is saying "no data".

    I got one point.

    when I'm saving data into file as unicode like:

    Code:
    mylist = [u"Mobile",u"Python"]
    save_list(u"c:\\mydata.txt",mylist)
    But it is printing like this when I load the data

    ['Mobile','Python']

    May be some unicode issue.

    I'm trying to resolve it. If you get any idea about it, then please let me know.

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    11

    Re: getting problem wth multi selection list

    Hi gaba88,
    I have resolved this problem. Bit change in load_list(). I'm adding this code may be helpful to other.
    Using unicode instead of simple string.


    Code:
    def load_list(filename):
       myfile = file(filename,"r")
       lst = []
       for line in myfile:
          lst.append(unicode(line.strip()))
       myfile.close()
       return lst

  7. #7
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: getting problem wth multi selection list

    hi furqanraza
    sorry for replying late and great that you resolved the problem and thanks for sharing that with every body.


    Enjoy Pythoning
    Gaba88

Similar Threads

  1. File Browsing Problem
    By Marwa in forum Mobile Java Networking & Messaging & Security
    Replies: 13
    Last Post: 2007-10-10, 15:52
  2. J2ME list problem
    By josual in forum Mobile Java General
    Replies: 1
    Last Post: 2006-09-22, 19:02
  3. Problem with J2ME POLISH using a list
    By josual in forum Mobile Java General
    Replies: 1
    Last Post: 2006-09-21, 00:47
  4. Replies: 1
    Last Post: 2005-02-09, 17:58
  5. Multi selection List box in Python on Series 60
    By disamant in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-12-27, 06:21

Posting Permissions

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