×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    20

    Keypress simulation

    Hello !
    I want to use keypress simulation, avoiding user have to press left key for saving a Python S60 form - in other words, I want that, when pressing right key ("Back"), form is automatically saved.
    Is it enough add the appropriate statement - "keypress.simulate_key(EKeyLeftSoftkey, EScancodeLeftSoftkey)" ?
    And where must I put it in my code ?
    Thanks for answers.

    That's the code I' using

    import appuifw
    from key_codes import *
    import keypress

    appuifw.app.title = u'Title'
    appuifw.app.body=appuifw.Canvas()

    while True:
    data = [(u'Val','number', 0), (u'Year','number', 0), (u'Tax','text', u'')]
    f = appuifw.Form(data, appuifw.FFormEditModeOnly)
    f.execute()

    val = f[0][2]
    year = f[1][2]
    tax = float(f[2][2])
    month = year * 12

    value = val *((tax/1200)*(pow((1+(tax/1200)),month))/(pow((1+(tax/1200)),month)-1))
    appuifw.popup_menu([u"value", unicode(value)])

    new_calc = appuifw.query(u"New calc", "query")
    if not new_calc:
    break

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Keypress simulation

    Hi,

    Please use code tags (the button with the # symbol on in in the post editor) when posting code because it keeps it indented and easier to read.

    Basically all you have to do is simulate the same keys you would press in order to achieve what you want. Somewhere after f.execute() is where you should do it (though it's a bit hard to be sure since the code is not indented).

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    20

    Re: Keypress simulation

    Thank you for the answer.
    But putting "keypress.simulate_key" code after "f.execute()" doesn't work - the phone still asks to save the form (as I have not simulate left key) and I get no results at all.
    What's wrong ?

  4. #4
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Keypress simulation

    Just to be clear, have you or have you not simulated the left softkey?

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    20

    Re: Keypress simulation

    Yes - but, as I said, after adding "keypress.simulate_key" code, the phone still asks to save the form (as I have not simulate the save key) and I get no results

Similar Threads

  1. [Announce] keypress module 1.0.5
    By y.a.k in forum Python
    Replies: 74
    Last Post: 2013-07-04, 17:40
  2. Key Press simulation - import problem
    By Jazzperson in forum Python
    Replies: 2
    Last Post: 2009-10-07, 09:58
  3. Replies: 8
    Last Post: 2009-07-28, 03:38
  4. Replies: 2
    Last Post: 2007-10-18, 00:02
  5. How to filter keypress belonging to foreground app
    By Donnieng in forum Symbian C++
    Replies: 1
    Last Post: 2007-07-09, 04:09

Posting Permissions

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