| Reply | « Previous Thread | Next Thread » |
|
Hi all,
I now have a query regarding Listbox... I have appended some items into the listbox using append().. I have used this append() inside another fn add().. But when I print the current item it is always printing the first item in the list.. Y is it like this.. Can someone provide soln for this.... |
|
Hi again,
I have added my code here.. The code might not sound professional so kindly bear with it... Code:
import appuifw
import e32
app_lock = e32.Ao_lock()
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
def menu():
global saved
lb=main()
fields = [(u"Name",'text',u'')]
flags = appuifw.FFormEditModeOnly
saved = False
def save(arg):
global saved
saved = True
return True
form = appuifw.Form(fields,flags)
form.save_hook= save
form.execute()
if saved == True:
add = form[0][2]
DynList.append(add)
lb = main()
appuifw.app.menu = [(u"Add",menu),(u"Exit",quit)]
DynList = [(u"John")]
def Handle_Selection():
lb = main()
appuifw.note(u"Welcome " + DynList[lb.current()])
def main():
lb = appuifw.Listbox(DynList,Handle_Selection)
appuifw.app.body = lb
return lb
main()
app_lock.wait()
I am not able to get the current listbox item at all... What change to make in this sample code to get the current item displayed... |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Online
Forum Nokia Champion
|
|
I wasn't able to find the exact problem with that code but it works if you make it less complicated by not making the main function return the Listbox instance:
Code:
import appuifw
import e32
app_lock = e32.Ao_lock()
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
def menu():
global saved
fields = [(u"Name",'text',u'')]
flags = appuifw.FFormEditModeOnly
saved = False
def save(arg):
global saved
saved = True
return True
form = appuifw.Form(fields,flags)
form.save_hook= save
form.execute()
if saved == True:
add = form[0][2]
DynList.append(add)
main()
appuifw.app.menu = [(u"Add",menu),(u"Exit",quit)]
def Handle_Selection():
appuifw.note(u"Welcome " + DynList[lb.current()])
DynList = [(u"John")]
def main():
global lb
lb = appuifw.Listbox(DynList,Handle_Selection)
appuifw.app.body = lb
main()
app_lock.wait()
Last edited by bogdan.galiceanu : 2009-04-27 at 14:32.
Reason: Added version with "main" function
|
|
Thank u very much bogdan.. But still I would be happy if I get a soln when called from inside a function.. I am using that sort of coding.....
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| how to display the Listbox | arungupta_2jan | General Symbian C++ | 4 | 2009-03-03 22:10 |
| problem in ListBox | aditighosal | General Symbian C++ | 8 | 2008-07-16 21:01 |
| Listbox... | harsh_vs | Symbian User Interface | 2 | 2008-02-15 21:29 |
| Full screen listbox skin not rendered correctly | template60 | General Symbian C++ | 2 | 2007-09-11 05:34 |
| ListBox Errors | javadi82 | Symbian User Interface | 7 | 2006-11-08 14:29 |