×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Problem Regarding canvas

    Hi Guyz! I m new to this forum. M a student of Bs Computer System Engineering. I worked before on flash lite , mobile basic..OK..Now i want to discuss my prob. I want to create an Interface in which there is a background , icons on the background and a cursor that can be control by keyboard. I almost Done every thing which i desire. But the biggest Problem m facing is in moving the cursor.When i press the keys , the cursor moves but the earlier position is not destroyed. M using
    Code:
    canvas.blit(image , target=(xs, ys))
    for moving the cursor..and By incrementing and decrementing in the desire axis on each keypress .But Blit only COPIES the image to desire axis. Thats y i get a number of cursors on each keypress.So, u guyz can help me if u have any solution to these problems :
    1) is there any method to destroy the canvas ?
    OR
    2) is there any method to change the postion of canvas like in Topwindow module. one canuse windows.position =(xs, ys)
    Or
    3) Any other solution to move the canvas to the postion (not to copy it)

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Problem Regarding canvas

    Quote Originally Posted by sajisoft View Post
    When i press the keys , the cursor moves but the earlier position is not destroyed. M using
    Code:
    canvas.blit(image , target=(xs, ys))
    for moving the cursor..and By incrementing and decrementing in the desire axis on each keypress .But Blit only COPIES the image to desire axis. Thats y i get a number of cursors on each keypress.
    The problem is in your code, just look more closely

    You have a static canvas and you just copy more stuff on it. As result you will see everything you have copied on it - including "old" copies of cursor image. This is how it should work, since this is how you wrote the code.

    Fix is easy. Remove "old" copy of cursor by drawing on top of that location an "empty" image. Maybe that is copy of your button graphics, maybe it's a rectangle with background color. Just cover the "old" cursor image with something else.

    When nothing else helps, redraw the whole canvas completely.

    Cheers,

    --jouni

  3. #3
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Re: Problem Regarding canvas

    Thanx sir for such a quick reply . I just solved the problem by drawing each time the background image and then the cursor image.So, the old image hides behind the background

Similar Threads

  1. List and keys/ midlet canvas problem
    By nuker85 in forum Mobile Java General
    Replies: 0
    Last Post: 2007-07-18, 13:18
  2. Problem MMC+USB Connection
    By Fede81 in forum Symbian
    Replies: 1
    Last Post: 2007-06-14, 06:13
  3. Problem MMC+USB Connection
    By Fede81 in forum General Development Questions
    Replies: 3
    Last Post: 2006-07-19, 15:21
  4. full canvas problem
    By SolaSoly in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2003-03-28, 03:29
  5. Problem with Image loading for Canvas
    By rsantossio in forum Mobile Java General
    Replies: 2
    Last Post: 2003-02-28, 00:24

Posting Permissions

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