I have listfield which contains several rows. It is working fine when i am using in blackberry torch(I can scroll the listfield and can select(click) any row). But the same application when i am using for blackberry storm 9500 I can not scroll because as soon as i am trying to scroll the row is getting selected(click).please tell me the reason why it is happening or the way to use listfield in storm

thank you

My lisfield class is

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.XYRect;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;

  public class SpeakersList implements ListFieldCallback
{
    private String[] products;
    private int rgb=Color.BLACK;
    Bitmap arraow;
    Bitmap placeholder;
    Bitmap holder[];
    int i=0;
    ImageLoad load;
    public Bitmap _bmap;
    ListField listField;
    TaskWorker taskWorker;
public SpeakersList(String[] products)
{
    this.products=products;
    arraow= Bitmap.getBitmapResource("arrow.png");
    DynamicImages images=new DynamicImages();
    placeholder=Bitmap.getBitmapResource(images.defaultimage);
    holder=new Bitmap[QandAScreen.imglist.length];
    taskWorker = new TaskWorker();
    taskWorker.addTask(new ImageDowload());
}

public void drawListRow(ListField listField, Graphics graphics, int index,
        int y, int width)
{
    this.listField=listField;
    final String text=(String) get(listField, index);
    if (graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS))
    {
    if(holder[index]==null)
    {
    holder[index]=placeholder;
    }
    graphics.setColor(0xC0C0C0);
    graphics.fillRect(0,y+0,480,59);
    graphics.setColor(rgb);
    graphics.setFont(Utility.getBigFont(15));
    graphics.drawBitmap(3,y+7,placeholder.getWidth(), placeholder.getHeight(),holder[index], 0, 0);
    graphics.drawText(text,70,y+20);  
    if(Display.getWidth()==480){
    graphics.drawBitmap(460,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
    }
    else if(Display.getWidth()==360)
    {
        graphics.drawBitmap(330,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
    }
    else
    {
    graphics.drawBitmap(300,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
    }
    graphics.drawLine(0, y+59, Display.getWidth(), y+59);
    }
    else
    {
        if(holder[index]==null)
        {
        holder[index]=placeholder;
        }
        graphics.setColor(rgb);
        graphics.setFont(Utility.getBigFont(15));
        graphics.drawBitmap(3,y+7,placeholder.getWidth(), placeholder.getHeight(),holder[index], 0, 0);
        graphics.drawText(text,70,y+20);  
        if(Display.getWidth()==480){
            graphics.drawBitmap(460,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
            }
        else if(Display.getWidth()==360)
        {
            graphics.drawBitmap(330,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
        }
            else
            {
            graphics.drawBitmap(300,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0);
            }
        graphics.drawLine(0, y+59, Display.getWidth(), y+59);
    }
}
public Object get(ListField listField, int index)
{
    return products[index];
}

public int getPreferredWidth(ListField listField)
{
    return Display.getWidth()+10;
}
public int indexOfList(ListField listField, String prefix, int start)
{
    return -1;
}

class ImageDowload extends Task
{
    void doTask()
    {


   for(;i<QandAScreen.imglist.length;i++)
   {
        String imgpath=QandAScreen.imglist[i];
         if(imgpath==null || imgpath.length()==0)
         {
          continue;
         }
        load=new  ImageLoad(QandAScreen.imglist[i]+Const.getExtra());
        if(load.getData()!=null)
        {
            UiApplication.getUiApplication().invokeLater(new Runnable() 
            {
                public void run()
                {

                    _bmap=load.getBitmap(40,40);
                    listField.invalidate(i-1);
                    holder[i-1]=_bmap;


               }
            });



        }
   }

    }
}
}
有帮助吗?

解决方案

Are you testing with the simulators or real devices? If my memory serves, the 9500 Storm uses the SureClick -display, where the display actually has a small microswitch underneath it, so it can detect touch and clicking (pressing the display) as separate actions. In the simulator, you need to use right mouse button to simulate touch and left to simulate click (or was it the other way around?). Torch (9800) hasn't got the SureClick-thingamabob, so the list can be scrolled with both right and left mouse buttons in the simulator (although they did have some distinction, other worked as touch and other sends continuous 'taps' to the screen or something).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top