[Copy to clipboard] [ - ]
CODE:
# -*- coding: utf-8 -*-
import appuifw, e32
## Simple MyFormView class to demonstrate the use of forms.
class MyFormView( object ):
## The constructor.
def __init__( self ):
## Bool
self._iIsSaved = False
## Model list.
self._iModels = [u'6600', u'6630', u'7610', u'N90', u'N70']
## Form fields.
self._iFields = [( u'Mobile', 'text', u'Nokia'),
( u'Model', 'combo', ( self._iModels, 0 ) ),
( u'Amount','number', 5 ),
( u'Date','date' ),
( u'Time','time' )]
## Displays the form.
def setActive( self ):
self._iIsSaved = False
self._iForm = appuifw.Form(self._iFields, appuifw.FFormEditModeOnly)
self._iForm.save_hook = self.mainForm
self._iForm.flags = appuifw.FFormEditModeOnly
self._iForm.execute( )
## save_hook send True if the form has been saved.
def _markSaved( self, aBool ):
self._iIsSaved = aBool
## _iIsSaved getter.
def isSaved( self ):
return self._iIsSaved
## Return mobile field value.
def getMobile( self ):
## This returns the mobile; In one case I needed to have UTF-8 encoding
return self._iForm[0][2].encode( "utf-8" )
def mainForm(self, aBool):
if aBool:
print u'for test.......'
menus = [u'pinfo', u'acct mang', u'acct trans']
appuifw.app.body = appuifw.Listbox(menus)
if __name__ == "__main__":
app_lock = e32.Ao_lock()
appuifw.app.title = u'Try Forms'
myForm = MyFormView( )
myForm.setActive( )
if not myForm.isSaved( ):
pass
#print myForm.getMobile( )
我想在按下“存储”菜单后马上显示'listbox'界面,但是这个程序能打印出'for test.....'却不能显示listbox,而且这个打印必需在按了右边的返回菜单才能出来,我想让它按下“存储”后马上显示listbox要怎样做呢?