×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    28

    switch to background without appswitch

    Is there e way to swithc my app to background without using the library appswitch?

    Thanks

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: switch to background without appswitch

    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

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    9

    Re: switch to background without appswitch

    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

Similar Threads

  1. error PRJ0019 error while creating sis file
    By mrshine in forum Symbian
    Replies: 3
    Last Post: 2008-10-17, 17:16
  2. How to make the background of a Custom Canvas Transparent
    By markchua_99 in forum Mobile Java General
    Replies: 4
    Last Post: 2008-09-30, 02:57
  3. Replies: 1
    Last Post: 2007-11-15, 15:45
  4. Nokia 6131 + Audio Player Background?
    By andrescm in forum Streaming and Video
    Replies: 0
    Last Post: 2007-10-15, 23:17
  5. What is application running in background?
    By newnb in forum Symbian
    Replies: 3
    Last Post: 2007-01-08, 03:03

Posting Permissions

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