Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 51
Registered: ‎08-25-2008
My Device: Not Specified
Accepted Solution

Focus control is working properly on 8700 but not on 8100

Hello Friends,

 

I have created screen in which i have taken 3 horizontal field managers. And I added 4 BitmapFields into them as follow

 

1st HFM : BitmapField for email

2nd HFM: BitmapField for SMS and BitmapField for Call Mobile

3rd HFM: BitmapField for Call landline

 

I have used following code to control the focus of all the bitmap fields

 

bmpOffFocusEmail = Bitmap.getBitmapResource(Utility.MAIL_OFF);
             objEmailBtn = new BitmapField(bmpOffFocusEmail, BitmapField.FOCUSABLE){
                Bitmap bmpOnfocusEmail = Bitmap.getBitmapResource(Utility.MAIL_ON);
                public void onFocus(int direction){
                    setBitmap(bmpOnfocusEmail);
                    invalidate();
                }         
                public void onUnfocus(){
                    setBitmap(bmpUnfocusEmail);
                    invalidate();
                }
                protected void drawFocus(Graphics graphics,  boolean on){
                }
             public boolean trackwheelClick( int status, int time ) {
                   
                    return true;
                }
            };

 

 The code is working properly on device 8700 but not for device 8100.....

Can anybody tell me, where m i going wrong? 

 

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

Not tested, but the first thing I would try is changing your drawFocus() to call super.drawFocus();  I think it should look like the following.

 

                protected void drawFocus(Graphics graphics,  boolean on){

                    super.drawFocus(graphics, on);
                }

Developer
Posts: 51
Registered: ‎08-25-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

Thanks for ur replay....

but it's not making any difference

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Focus control is working properly on 8700 but not on 8100

Plase see this sample.

 

How To - Show focus changes using BitmapField
Article Number: DB-00427

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

To help replicating this, can you confirm the JDE level you are using for development (presumably 4.1), plus the OS level of the Pearl and 8700.  Also the model number for the Pearl. 
Developer
Posts: 51
Registered: ‎08-25-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

Smiley Sad Sorry, I am new to Blackberry,  I don't know from where to check OS level but I am using JDE 4.2.0.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

Options-->About
Developer
Posts: 51
Registered: ‎08-25-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

[ Edited ]

I modified the code and wrote a single method for setting BitbampField rather than writting it frequently.

 

  /**
     * Description : this method creates bitmap field and controls it's focus property
     * @param bmpOffFocus : the bitmap drawn when bitmapField looses a focus
     * @param bmpOnFocus  : the bitmap drawn when bitmapField gets a focus
     * @return BitmapField
     */
    public BitmapField getBitmapField(final Bitmap bmpOffFocus, final Bitmap bmpOnFocus) {
        BitmapField objBmpBtn = new BitmapField(bmpOffFocus, BitmapField.FOCUSABLE) {
        
            protected void onFocus(int arg0) {
                setBitmap(bmpOnFocus);
                invalidate();
            }

            protected void onUnfocus() {
                super.onUnfocus();
                setBitmap(bmpOffFocus);
                invalidate();
            }

            protected void paint(Graphics graphics) {
               graphics.setBackgroundColor(0xDFBC7A);
               graphics.clear();
               super.paint(graphics);
            }

       };

        return objBmpBtn;
    }

  

Message Edited by dhanashreerao on 10-16-2008 06:14 AM
Developer
Posts: 51
Registered: ‎08-25-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

v4.2.0.61

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Focus control is working properly on 8700 but not on 8100

Could you please tell us again the problem you are seeing with this code. Exactly what do you see on each device and how does this differ to what you expect to see. 

 

Can you give us the OS Level on both the Pearl and the 8700.

 

Finally, I have tried the code supplied, with one change, I removed the

super.onUnfocus();

Seems to work fine.