×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    how to switch from one multi selection list to another ..??

    hii

    i m writing a mobile application using pys60...i am selecting two checkboxes from a multi_selection_list and on the return values i m applying a query which selects another set of values from database (already created using e32db)...what i want is on selecting 2 values from previous multi selection list based on the query fired the values retrieved should be displayed as another multiselection list...
    but after i select the values from first list application quits.......

    please answer...its urgent!!!
    thanks

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: how to switch from one multi selection list to another ..??

    HI,
    Welcome to the Forum Nokia Discussion board.

    You can create list in already existing list , using loop inside loop.

    You can see here : http://wiki.forum.nokia.com/index.ph...tbox_for_PyS60

    Best regards,

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    Hii
    Thanks a lott..

    i tried the code from the suggested link...but enumerate is giving error....how can i solve it?

    Thanks
    Sherry

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: how to switch from one multi selection list to another ..??

    Are you testing in which SDK version .Also tell us your Pys60 version.?

    Best regards,

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    SDK 3rd edition and pythonfor S60 1.9.7

    Sherry

  6. #6
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: how to switch from one multi selection list to another ..??

    Then it should work ?
    Because the code in that example was tested by developer in the device and in emulator also.

    By the way copy paste you code here and show us the error you are getting.

    Best regards,

  7. #7
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    first menu>click on girls>select any number>error appears(PYTHON: SYSTEM ERROR(-50))
    This is my code

    import appuifw
    import messaging
    import appuifw, e32
    import e32db
    appuifw.app.screen = "full"
    appuifw.note(u"Opening...")
    appuifw.note(u"Almost finished....", "conf")
    def quit():
    app_lock.signal()
    appuifw.app.exit_key_handler=quit
    def get_girl_names():
    girls_names=[]
    girl_name=[]
    print u'entering girls section'
    for i in room_selected:
    query=u'select name from test_table where room_no=rooms[room_selected[i]]'
    try:
    dbv.prepare(db,query)
    print u'retrieving girl name'
    for i in range(1,dbv.count_line()+1): #1 to number of rows
    dbv.get_line() #grabs the current row
    girl_name.append(dbv.col(1)) #prints each column data
    print dbv.col(1)
    print girl_name[i-1]
    dbv.next_line() #move to the next rowset[[Category:Entertainment]]
    except SymbianError:
    print "failed to read database: "
    girls_names=list(girl_name)
    girls_selections = appuifw.multi_selection_list(girl_name,'checkbox',1)
    appuifw.app.body=girls_selecions
    appuifw.app.menu=[(u"make announcement to these girls",announce),(u"make announcements to her wingies",announce_wing)]
    e32.ao_yield()
    appuifw.app.exit_key_handler = quit
    def callback_A():
    rooms=[]
    global room_selected
    room_selected=[]
    query=u'select room_no from test_table'
    try:
    dbv.prepare(db,query)
    for i in range(1,dbv.count_line()+1): #1 to number of rows
    dbv.get_line() #grabs the current row
    rooms.append(dbv.col(1))
    dbv.next_line() #move to the next rowset[[Category:Entertainment]]
    except SymbianError:
    print "failed to read database: "
    room_selections = appuifw.multi_selection_list(rooms,'checkbox',1)
    room_selected=list(room_selections)
    appuifw.app.body=room_selections
    appuifw.app.menu =[(u"get girl names",get_girl_names)]
    appuifw.app.exit_key_handler = quit
    appuifw.app.title=u"Announcement System"
    #initiate db access
    db=e32db.Dbms()
    dbv=e32db.Db_view()
    global appuifw
    # name of the database file
    dbname = u'c:\\python\\testdatabase.db'
    #open database, if it does not exist, then create it
    try:
    db.open(dbname)
    except:
    print u"error opening database"
    def callback_B():
    print "B"
    def callback_C():
    print "C"
    def callback_D():
    print "D"
    print u"\nprinting menu list.........."
    appuifw.app.menu=[(u"Girls", callback_A), (u"Workers", ((u"Mess Workers", callback_C), (u"Sweepers", callback_D)))]
    g_t = appuifw.Text()
    g_t.style = appuifw.STYLE_BOLD
    g_t.add(u"Select option from Options menu:\n\n")
    g_t.add(u"Girls: ")
    g_t.style = 0
    g_t.add(u"make announcement to particular selected girls\n")
    g_t.style = appuifw.STYLE_BOLD
    g_t.add(u"Workers")
    g_t.style = 0
    g_t.add(u"make announcement to either mess workers or sweepers\n")

    # Show to user
    appuifw.app.body = g_t
    app_lock=e32.Ao_lock()
    app_lock.wait()

  8. #8
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    and with the code on ur suggested link error is:
    line 121
    my_items = tuple(i for i,x in enumerate(e3) if x[1] == icon_on)
    ^
    Syntax error

  9. #9
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    hii

    i m waiting for ur reply for my proceedings...plz rply watever it is...it ll be really helpful to me.

    Thanks
    Sherry

  10. #10
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    heyy

    plzzzzzzzzzzzz rply.. if d answer is "nthing can be done or watever" then also i m waiting !!
    if anyone else can help plz do it....

    Thanks.
    Sherry

  11. #11
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: how to switch from one multi selection list to another ..??

    Quote Originally Posted by garg.sherry View Post
    and with the code on ur suggested link error is:
    line 121
    my_items = tuple(i for i,x in enumerate(e3) if x[1] == icon_on)
    ^
    Syntax error
    Hi, garg you are getting Syntax error,,, I hope which you can remove by changing it to correct.

    But the code that I suggested in that article is well tested in emulator, and working..

    Try to simplify that code and and again write it. And tell us.

    Best regards,

  12. #12
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: how to switch from one multi selection list to another ..??

    Quote Originally Posted by garg.sherry View Post
    hii

    i m waiting for ur reply for my proceedings...plz rply watever it is...it ll be really helpful to me.

    Thanks
    Sherry
    Can you plesae post your code againg using the CODE tag. As the code thatr you had posted does not maintain the white space and it is important to maintain the white space in python.
    After you click on the reply ,Click on to Go Advance" and there you find a " # " button. Use that button to post your code. Than it would be easy to test your code.

    Regards
    Jajal Mehul

  13. #13
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    First i m creating a database by running this script...

    Code:
    import e32db,sys,traceback
     
    #initiate db access
    db=e32db.Dbms()
    dbv=e32db.Db_view()
     
    # name of the database file
    dbname = u'c:\\python\\testdatabase.db'
     
    #open database, if it does not exist, then create it
    try:
      db.open(dbname)
    except:
      db.create(dbname)
      db.open(dbname)
     
     
    #Create the database table
    try:
      # note that the id field is auto-incremented when new rows are added
      db.execute(u"CREATE TABLE test_table (id counter, name VARCHAR, surname VARCHAR, room_no VARCHAR, block_no VARCHAR,floor_no VARCHAR, wing_no VARCHAR,mobile_no VARCHAR)")
      print "Table Created"
    except SymbianError:
      print "Error Creating table: "
      #print traceback.format_exception(*sys.exc_info())
      print sys.exc_info()[0]
      print sys.exc_info()[1]
      print sys.exc_info()[2]
     
    # attempt to insert data
    try:
      # note that the id field is NOT required, as it auto-increments 
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('rose','kunthara','251','0','1','1','123')")
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('nayla','pandit','252','0','1','1','234')")
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('reetika','malhotra','253','0','1','1','345')")
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('sherry','garg','254','0','1','1','456')")
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('alekhya','mandadi','255','0','1','1','567')")
      db.execute(u"INSERT INTO test_table(name, surname,room_no,block_no,floor_no,wing_no,mobile_no) VALUES('rucha','oza','256','0','1','1','678')")
      print "Data Inserted"
    except SymbianError:
      print "Could not insert data: ", SymbianError.args
      print sys.exc_info()[0]
      print sys.exc_info()[1]
      print sys.exc_info()[2]
     
     
     
     
    #to fetch the whole dataset
    try:
      dbv.prepare(db,u'SELECT * FROM test_table')
      for i in range(1,dbv.count_line()+1): #1 to number of rows
        dbv.get_line() #grabs the current row
        for i in range(1,dbv.col_count()+1):
          print dbv.col(i) #prints each column data
        dbv.next_line() #move to the next rowset[[Category:Entertainment]]
    except SymbianError:
      print "failed to read database: "
      print sys.exc_info()[0]
      print sys.exc_info()[1]
      print sys.exc_info()[2]
     
    # close the database
    db.close()

  14. #14
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    and secondly i run this script...and get the error after i follow the sequence-> Girls>select nos.(one or more)>error

    Code:
    import appuifw
    import messaging
    import appuifw, e32
    import e32db
    appuifw.app.screen = "full"
    appuifw.note(u"Opening...")
    appuifw.note(u"Almost finished....", "conf")
    def quit():
        app_lock.signal()
        appuifw.app.exit_key_handler=quit
    def get_girl_names():
        girls_names=[]
        girl_name=[]
        print u'entering girls section'
        for i in room_selected:
            query=u'select name from test_table where room_no=rooms[room_selected[i]]'
            try:
                dbv.prepare(db,query)
                print u'retrieving girl name'
                for i in range(1,dbv.count_line()+1): #1 to number of rows
                    dbv.get_line() #grabs the current row
                    girl_name.append(dbv.col(1)) #prints each column data
                    print dbv.col(1)
                    print girl_name[i-1] 
                    dbv.next_line() #move to the next rowset[[Category:Entertainment]]
            except SymbianError:
                print "failed to read database: "
        girls_names=list(girl_name)
        girls_selections = appuifw.multi_selection_list(girl_name,'checkbox',1)
        appuifw.app.body=girls_selecions
        appuifw.app.menu=[(u"make announcement to these girls",announce),(u"make announcements to her wingies",announce_wing)]
        e32.ao_yield()
        appuifw.app.exit_key_handler = quit
    def callback_A():
        rooms=[]
        global room_selected
        room_selected=[]
        query=u'select room_no from test_table'
        try:
            dbv.prepare(db,query)
            for i in range(1,dbv.count_line()+1): #1 to number of rows
                dbv.get_line() #grabs the current row
                rooms.append(dbv.col(1))
                dbv.next_line() #move to the next rowset[[Category:Entertainment]]
        except SymbianError:
            print "failed to read database: "
        room_selections = appuifw.multi_selection_list(rooms,'checkbox',1)
        room_selected=list(room_selections)
        appuifw.app.body=room_selections
        appuifw.app.menu =[(u"get girl names",get_girl_names)]
        appuifw.app.exit_key_handler = quit
    appuifw.app.title=u"Announcement System"
    #initiate db access
    db=e32db.Dbms()
    dbv=e32db.Db_view()
    global appuifw 
    # name of the database file
    dbname = u'c:\\python\\testdatabase.db'
    #open database, if it does not exist, then create it
    try:
        db.open(dbname)
    except:
        print u"error opening database"
    def callback_B():print "B"
    def callback_C():print "C"
    def callback_D():print "D"
    print u"\nprinting menu list.........."
    appuifw.app.menu=[(u"Girls", callback_A), (u"Workers", ((u"Mess Workers", callback_C), (u"Sweepers", callback_D)))]
    g_t = appuifw.Text()
    g_t.style = appuifw.STYLE_BOLD
    g_t.add(u"Select option from Options menu:\n\n")
    g_t.add(u"Girls: ")
    g_t.style = 0
    g_t.add(u"make announcement to particular selected girls\n")
    g_t.style = appuifw.STYLE_BOLD
    g_t.add(u"Workers")
    g_t.style = 0
    g_t.add(u"make announcement to either mess workers or sweepers\n")
     
    # Show to user
    appuifw.app.body = g_t
    app_lock=e32.Ao_lock()
    app_lock.wait()

  15. #15
    Registered User
    Join Date
    Oct 2010
    Posts
    10

    Re: how to switch from one multi selection list to another ..??

    i have posted my code...and the way i m proceeding n getting error....Please help if u can

    Thanks
    Sherry

Similar Threads

  1. Multi-selection popup list control
    By logan04x in forum Symbian
    Replies: 3
    Last Post: 2010-05-04, 09:01
  2. Multi Selection List? Carbide.c++ 2.0
    By FrankTheFox in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-01-28, 13:33
  3. Multi Selection List
    By disamant in forum Symbian
    Replies: 7
    Last Post: 2008-12-31, 12:23
  4. multi selection list problem :(
    By cool_eagle in forum Symbian
    Replies: 15
    Last Post: 2008-08-19, 08:31
  5. Multi selection List Box
    By disamant in forum Symbian
    Replies: 0
    Last Post: 2005-08-27, 07:25

Posting Permissions

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