×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    22

    CustomItem repaint very slow

    Hi,

    I have a customitem on a form, and have about 15 sentences of text written with drawstring to it.

    My problem is that is it very slow to scroll up and down the customitem.

    Of course, when I use a normal stringitem object, it is extremely fast, but when I switch to a customitem and write the text in colour into the customitem, things turns ugly.

    How can I make the repaint faster? I want realtime speed like the same as with stringitem.

    Thanks in advance,
    Peanuts.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Posts
    22

    Re: CustomItem repaint very slow

    Problem was solved by adding the traverse method to the customitem, and over-riding it with just a return false, meaning, DONT go traverse inside the big customitem that Ive used.

    However, my next problem is that I have a textbox and customitem on the form, and as the user types in text the whole screen refresh with each keypress! Of course the displayed text inside the customitem haven't changed, so it doesnt need to be refresh, but I don't know how to switch it off!!

    At first I thought the clever answer is to add the keypressed method to my customitem class, but that wasn't the answer, since customitem doesnt have the focus, remember the texbox has it, so it looks to me like the FORM is called keypressed each time to refresh it, which makes perfectly sense otherwise the user won't see the keypressed key for the next text, BUT it also seems to call the paint() of my customitem, which is a rather big screensize and complex computing, which takes a long while.

    The problem then is that the user feels like the input text box is very sluggish, since it is so slow...

    How can I switch it off that my custom item doesnt get a repaint each time the user types something in another textbox?

    Quite a headache, any ideas appreciated.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    22

    Re: CustomItem repaint very slow

    OK, doesn't seem like I can switch keypressed off, since it is a FORM event and I don't have access to it from the customitem class.

    I am going to attempt to use double buffering, and this create a switch in the paint() , so that I can just load an image directly, rather than draw the whole thing again from scratch, eventho nothing changed on it!

    Wish me luck, I will report back if that worked.

    MIDP - programming what nobody has programmed before

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    22

    Re: CustomItem repaint very slow

    Yup, that worked!

    Double buffering prohibits the paint() , I just draw the image from memory when it needs it. Stupid, but it works.
    If you know of a way to actually switch it off, and not do this workaround, please let me know.

    The speed has increase dramatically. Back to real-time performance, so I am happy.

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: CustomItem repaint very slow

    Thanks for keeping us updated and informing others of your solutiuon!

    and sorry for the non-responses :-(

    Hartti

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    22

    Re: CustomItem repaint very slow

    hartti,

    I think the MIDP standard is good, but the implementation on different phones is not all equally good.

    Furthermore, I think alot of MIDP programming is ground-breaking, you kinda have to try 10 different things until something works, but perhaps that is just my lack of coding experience on the platform.

    Also, with this solution it seems like on certain phones it runs out of memory, and on others not. I will call manually garbage collection to clean up the memory quicker, hopefully that will do the trick. I will update this thread later, to say if it was successful or not, some other guys will have to test it, since I dont have a phone personally with this problem it seems.

    Another day, another MIDP glitch.

    Thanks for the feedback tho!

Similar Threads

  1. Problem with TextField and CustomItem on the same Form
    By manmli in forum Mobile Java General
    Replies: 8
    Last Post: 2008-12-23, 13:10
  2. CustomItem overlaps TextField
    By asashour in forum Mobile Java General
    Replies: 2
    Last Post: 2007-03-27, 11:35
  3. Series 60 CustomItem implementation problems?
    By fotis.chatzinikos in forum Mobile Java General
    Replies: 2
    Last Post: 2005-03-10, 15:48
  4. CustomItem doesn't repaint properly.
    By akokchai in forum Mobile Java General
    Replies: 4
    Last Post: 2004-06-08, 10:42
  5. Repaint calls ignored in paint method on S40
    By sam.hendley in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2003-07-26, 06:45

Posting Permissions

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