ashutosh12,
The menu you refer to are the tabs in the navigation pane. The source below show you how it works.
Also their are no methods in appuifw.app that retrieve the current active tab nether if this menu is displayed. But on the other hand I'm not sure this would be that useful since everything can be handled in the source.
Code:
import e32, appuifw
# Just a dummy handler...
def menu_action( aIndex ):
print "menu: ", aIndex
# aIndex receives the index of the tab to activate
def tabs_handler( aIndex ):
# activate the right tab
appuifw.app.activate_tab( aIndex )
e32.ao_yield()
# TODO: implement the views
if aIndex == 0:
appuifw.app.body = VIEW0
elif aIndex == 1:
appuifw.app.body = VIEW1
elif aIndex == 2:
appuifw.app.body = VIEW2
elif aIndex == 3:
appuifw.app.body = VIEW3
elif aIndex == 4:
appuifw.app.body = VIEW4
# Exit handler
def __exit__():
# desable tabs
appuifw.app.set_tabs( [], [] )
# release the lock
APP_LOCK.signal()
if __name__ == "__main__":
# create an active object
APP_LOCK = e32.Ao_lock()
# set title
appuifw.app.title = u"Menu and tabs"
# set exit handler
appuifw.app.exit_key_handler = __exit__
VIEW0 = appuifw.Text(u'View0')
VIEW1 = appuifw.Text(u'View1')
VIEW2 = appuifw.Text(u'View2')
VIEW3 = appuifw.Text(u'View3')
VIEW4 = appuifw.Text(u'View4')
# define a menu structure
menu = [( u'Item0', lambda:menu_action(0) ),
( u'Item1', lambda:menu_action(1) ),
( u'Item2', lambda:menu_action(2) ),
( u'Item3', lambda:menu_action(3) )]
# set the menu (Options button)
appuifw.app.menu = menu
# get an print the menu
# print appuifw.app.menu
# define tabs
tabs = [u't0', u't1', u't2', u't3', u't4']
# set tabs and it callback
appuifw.app.set_tabs( tabs, tabs_handler )
# set view to the app body
appuifw.app.body = VIEW0
APP_LOCK.wait()
LFD