Here's an example of what I mean.
When you run the script below after the info message you are presented a single choice.
The left softkey displays "OK" and chooses the option. The right softkey shows "Exit". Hitting exit at this point calls the exit_key_handler. So far so good.
When the option is chosen a simple form is shown. The softkeys now read "Options" and "Back".
What I'd like to do is trap the "Back" event, and make it call show_main_view again (i.e. display the info message again).
Thanks again.
M.
Code:
import e32
import appuifw
class Test:
def __init__(self):
self.lock = e32.Ao_lock()
appuifw.app.exit_key_handler = self.abort
self.exit_flag = False
def show_main_view(self):
appuifw.note(u"Hello", 'info')
self.choice = [(u"Choice 1") ]
self.lb = appuifw.Listbox(self.choice, self.callback)
appuifw.app.body = self.lb
def callback(self):
self.fields = [(u"Text Field", 'text') ]
self.form = appuifw.Form(self.fields, appuifw.FFormDoubleSpaced)
self.form.execute()
def abort(self):
self.exit_flag = True
self.lock.signal()
def run(self):
while not self.exit_flag:
self.show_main_view()
self.lock.wait()
if __name__ == "__main__":
old_title = appuifw.app.title
old_exit_key = appuifw.app.exit_key_handler
try:
appuifw.app.title = u"Test"
e32.ao_yield()
app = Test()
app.run()
finally:
appuifw.app.set_tabs([], None)
appuifw.app.exit_key_handler = old_exit_key
appuifw.app.title = old_title