×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    29

    Limit the COunt Range..??

    Hi...
    This is the code I used to print count everytime when down/up arrow is pressed,i.e, when down arrow is pressed count is incremented,and decremented when up arrow is pressed.
    But now I need to give the count value to be of some range e.g 0 to 5,how can I do this, what changes are to be made..??


    Code:
    import appuifw, key_codes, e32
    
    
    count = 0
    def keys(event):
    	global count
    	
    	if event ['keycode'] == key_codes.EKeyDownArrow:
    		down()
    	elif event ['keycode'] == key_codes.EKeyUpArrow:
    		up()
    		
    def down():
    	global count
    	count+=1
    	print count
    	
    def up():
    	global count
    	count-=1
    	print count
    	
    def quit():
    	app_lock.signal()
    
    canvas = appuifw.Canvas(event_callback = keys)
    appuifw.app.body = canvas
    appuifw.app.exit_key_handler = quit
    app_lock = e32.Ao_lock()
    app_lock.wait()
    Regards
    Ashwini
    Last edited by wizard_hu_; 2012-05-10 at 10:46. Reason: added [CODE][/CODE] for preserving indentations

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: Limit the COunt Range..??

    That is called programming...
    Code:
    def down():
    	global count
    	count+=1
    	print count
    could become something like
    Code:
    def down():
    	global count
    	if count < 5:
    		count+=1
    	print count
    or (wrap-around)
    Code:
    def down():
    	global count
    	count+=1
    	if count > 5:
    		count = 0
    	print count

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    29

    Re: Limit the COunt Range..??

    Hey thank u so much...I was trying with while loop. Guess this must work fine now. Thank u

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    29

    Re: Limit the COunt Range..??

    Hi..I can see the output only when I exit, what changes do i have to make in the code so that, each time down/up arrow is pressed the note pop up should appear.
    Can I make use of appuifw.note(), but how to use it so that each time it shows the output when keys are pressed.


    REgards
    Aarushi

Similar Threads

  1. Range of microphone
    By sujithkannan in forum Symbian
    Replies: 1
    Last Post: 2011-01-06, 06:28
  2. N95 Temperature range
    By carlos.menendez in forum General Development Questions
    Replies: 1
    Last Post: 2008-07-31, 12:39
  3. Bluetooth range
    By thefrozenrose in forum Bluetooth Technology
    Replies: 0
    Last Post: 2006-10-14, 15:20
  4. Installation file count limit ?
    By navjotsingh1979 in forum Symbian
    Replies: 2
    Last Post: 2006-09-18, 10:54
  5. Bluetooth range sux!
    By carl404 in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2004-04-19, 12:49

Posting Permissions

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