You Are Here:

Community: Developer Discussion Boards

#1 Old switch to background without appswitch - 2009-04-16, 15:41

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
Is there e way to swithc my app to background without using the library appswitch?

Thanks
Reply With Quote

#2 Old Re: switch to background without appswitch - 2009-04-16, 17:27

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Yes, using the keypress extension. Just simulate the red (hang-up) key after telling Python not to close when this happens. Here's an example:
Code:
import appuifw, e32, keypress, sys
from key_codes import *


#Create an active object
app_lock = e32.Ao_lock()

#Define the function to be called when the right softkey is pressed
def quit():
	app_lock.signal()
	appuifw.app.set_exit()

appuifw.app.exit_key_handler = quit

#Define the function to be called when the red key is simulated
def myexitfunc():
    s = appuifw.app.screen
    appuifw.app.screen = 'large'
    appuifw.app.screen = s
    app_lock.wait()

#Set it as the red key's function
sys.exitfunc = myexitfunc

#Your code goes here. For example, an instance of Text
appuifw.app.body = appuifw.Text(u"abc")

#Wait 4 seconds
e32.ao_sleep(4)

#Simulate the red key
keypress.send_raw_event(keypress.EKeyDown,EScancodeNo)
keypress.send_raw_event(keypress.EKeyUp,EScancodeNo)
The first 3 lines in myexitfunc's definition are there to make sure the application looks normal when brought back to the foreground. The information on the title pane would be missing without them. See this post for more about this.

Still, appswitch is a lot better than doing all that
Reply With Quote

#3 Old Re: switch to background without appswitch - 2009-04-16, 20:27

Join Date: Nov 2007
Posts: 4
madhacker
Offline
Registered User
i've created a python library both for 2nd and 3rd.

v3: http://www.2shared.com/file/5375674/361b6060/msys.html
v2: http://www.2shared.com/file/5375651/...d/msys2nd.html

msys.send_bg() -> send your app to background
msys.send_fg() -> send your app to foreground
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
error PRJ0019 error while creating sis file mrshine General Symbian C++ 3 2008-10-17 18:16
How to make the background of a Custom Canvas Transparent markchua_99 Mobile Java General 4 2008-09-30 03:57
[announce] [patch] switch to background when EndKey pressed nlsp Python 1 2007-11-15 16:45
Nokia 6131 + Audio Player Background? andrescm Streaming and Video 0 2007-10-16 00:17
What is application running in background? newnb General Symbian C++ 3 2007-01-08 04:03

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia