Skip to main content

CustomItem - scrolling is disable

2 replies [Last post]
jbernhard
Offline
Joined: 2007-10-09

Hello,

i have written an calendar application in java me. i have written day view with CustomItem and this CustomItem has a height of 450 pixel, but the display's height of my device is 300 pixel. On the Sun Wireless Toolkit it is possible to scroll up and down, but on the virtual machine of my device there is no scrollbar.
In another device it is possible to scroll down, but not until the end of my CustomItem.
What could i do to enable scrolling??
Is this a bug of the virtual machine or a bug in my developed CustomItem??

Thank you for any help.

Regards,
Bernhard

Message was edited by: jbernhard

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jbernhard
Offline
Joined: 2007-10-09

thx
for your answer.

Now, I have another problem.
I have a device which support scrolling (no special code to manage scrolling).
How do I find out which part of the CustomItem is visible for users and which part is out of screen size, because i have to draw text at top of visible area.

Regards,
Bernhard

sfitzjava
Offline
Joined: 2003-06-15

Are you doing any special coding to manage the scrolling?
If you are relying on JavaME to do this scrolling for you then you are going to have hits and misses.
Some devices will allow for this scroll features others expect you to handle it. So usually it's best to do it yourself so that you know it gets done.

Typically you would use the translate(x,y) on the object being painted to alter it's origin to a point off screen. However this can be very costly if you are painting a lot of detailed graphics on a large canvas. (eg. a google maps app would not want to paint all the images that were off screen)

It's not really a bug in the virtual machine per se, because of how JmeVM builders can "interpret" the JSR spec. However because behaviors are so different you should put the scrolling code into your UI component. There is not a standard that I'm aware of for doing this, so you should search for examples, and pick which method works best for you. As I mentioned one is the translate(x,y), another would be to maintain a x,y,w,h and scrollx scrolly then calculate the visible area, and draw the needed parts.

Regards,
-Shawn