BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-31-2009, 05:07 AM   #1
taqi.mir
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: AT
Posts: 81
Default Searching for list item

Please Login to Remove!

Hi,

I am posting more than a thread because i have not found any solution for selecting particular row in the ListField though i have implemented the indexOfList method .
My written code looks like below,

public int getPreferredWidth(ListField fieldVar)
{
//use all the width of the current LCD
return Graphics.getScreenWidth();
}
int searchIndex;
boolean bolResult;
public int indexOfList
(ListField fieldVar,String prefix,int start)
{
for (int a=0; a<_table.size();a++)
{
Object obj= _table.elementAt(a);
if(obj instanceof String)
{
String entry =(String)obj;
bolResult = entry.startsWith(prefix);
if(entry.startsWith(prefix)==true);
{
searchIndex=_table.indexOf(entry);
// Dialog.inform(""+bolResult);
break;
}
}
}

fieldVar.setSelectedIndex(searchIndex);

return _table.indexOf(prefix,start);
}

Am i doing something worng,please quick response will be appreciated.
Offline  
Old 01-31-2009, 05:58 AM   #2
taqi.mir
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: AT
Posts: 81
Default

Why setSelectedIndex(searchIndex) this method doesn't work in the below code? public int indexOfList
(ListField fieldVar,String prefix,int start)
{
for (int a=0; a<_table.size();a++)
{
Object obj= _table.elementAt(a);
if(obj instanceof String)
{
String entry =(String)obj;
bolResult = entry.startsWith(prefix);
//if(entry.startsWith(prefix)==true);
//{
//searchIndex=_table.indexOf(entry);
if(bolResult)
{

searchIndex=_table.indexOf(entry);
Dialog.inform(""+searchIndex);
listField.setSelectedIndex(searchIndex);
listField.invalidate(searchIndex);

break;
}

// Dialog.inform(""+bolResult);

//}
}
}

//fieldVar.setSelectedIndex(searchIndex);

return searchIndex;
}
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Vintage Apple Computer 4” Paper Cube Notepad Macintosh 80s 90s Office White picture

Vintage Apple Computer 4” Paper Cube Notepad Macintosh 80s 90s Office White

$39.95



6502 CPU - Over 100 chips on a vintage 4 inch Silicon wafer picture

6502 CPU - Over 100 chips on a vintage 4 inch Silicon wafer

$275.00



Vintage Post-it Note Pad Apple Magnetic Holder Pince A Notes Unused 1988 NOS picture

Vintage Post-it Note Pad Apple Magnetic Holder Pince A Notes Unused 1988 NOS

$12.74



Apple 1 Replica IC's: Vintage IC’s Many Types See List NOS 74XXX Types - Apple I picture

Apple 1 Replica IC's: Vintage IC’s Many Types See List NOS 74XXX Types - Apple I

$20.00



Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod picture

Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod

$45.00



VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED picture

VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED

$25.95







Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.