views:

343

answers:

3

in my screen there are 3 managers h1 h2 bmpf = new BitmapField

added in order like this as

backgroundmanager.add(h1)
backgroundmanager.add(bmpf)
backgroundmanager.add(h2)

add(background manager);

protected boolesn navigationClick()
{
int index1 = h1.getFieldWithFocusIndex();
int index2 = h2.getFieldWithFocusIndex();
return true;
}

mow i get the focus index of all focussable fields in managers h1 and h2

but i cant get index of the bitnmapfield on focus i need to execute some code on its click

what to do

A: 

What for you need BitmapField index? Maybe it will be easier to declare BitmapField as a screen member? If you still will need index, call getIndex() from field.

class Scr extends MainScreen {
    BitmapField mBitmapField;

    protected boolean navigationClick(int status, int time) {
        int bmpIndex = mBitmapField.getManager.getFocusedIndex();
        return true;
    }
}

UPDATE Other useful method in Field class is getManager():

class Scr extends MainScreen {
    BitmapField mBitmapField;

    protected boolean navigationClick(int status, int time) {
        int index = -1;
        Manager manager = mBitmapField.getManager();
        if (manager != null) {
             index = manager.getFieldWithFocusIndex();
        }
        return true;
    }
}
Max Gontar
hey i want to find the index of Bitmapfieldfield when it is focussedi.e. focus index coz on navigation click i check the focus index n accordingly fire a code
SWATI
Max it always shows index = (-1)i also tried wid custom field but same (-1)
SWATI
why don't you simply test mBitmapField.isFocus()?
Max Gontar
Have you created this BitmapField with FOCUSABLE style?
Max Gontar
well i m working with stormmBitmapField.isFocus() does not also workn bitmapfield is also focussablewhat to do
SWATI
what about implement BitmapButtonField? http://stackoverflow.com/questions/1445953/blackberry-user-interface-design-customizable-ui/1450719#1450719
Max Gontar
A: 

well i set the extent of the bitmap field and placed the bitmap field in an horizontal field manager and it worked

in

class myscreen extends MainScreen
 {
    BitmapField mBitmapField;

    hm = new HorizontalFieldManager();
    hm.add(mBitmapField)

    protected boolean navigationClick(int status, int time)
   {       
        if (hm.getFieldWithFocusIndex==0) 
        {
             Dialog.inform("Image focussed");
        }
        return true;
    }
}

i dont understand why earlier same logic was not working!!!!!!!!!!

may be bcoz of extent of BitmapField

SWATI
A: 
Alex