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
Developer
yann247
Posts: 96
Registered: ‎03-06-2009
Accepted Solution

Focus on bitmap in a HorizontalFieldManager

[ Edited ]

Hello,

 

I have a bitmap in a HFM, I made it focusable (the bitmap).

Problem is, when the bitmap gets focused, the whole HFM turns blue, like if it was focused itself.

 

I try putting the bitmap in a VFM which I put in the HFM to limit the focus to the HFM but it didn't work.

 

Any idea how i can do?

There is the code:

 

 

HorizontalFieldManager imageHfm = new HorizontalFieldManager(Field.USE_ALL_WIDTH) {

 protected void paint(Graphics graphics) {

graphics.setBackgroundColor(0x000000); graphics.clear(); super.paint(graphics); }

};

VerticalFieldManager imageVfm = new VerticalFieldManager(Field.FIELD_RIGHT); Bitmap loginButton = new Bitmap(Bitmap.getBitmapResource("login1.png"), DrawStyle.RIGHT) { public boolean trackwheelClick(int status, int time) { connectionWrapper(); return true; } }; imageVfm.add(loginButton); imageHfm.add(imageVfm);

 

 

 

Message Edited by yann247 on 05-07-2009 05:07 PM
Please use plain text.
Developer
yann247
Posts: 96
Registered: ‎03-06-2009

Re: Focus on bitmap in a HorizontalFieldManager

When I replace Drawstyle by Field.FIELD_RIGHT, the HFM doesnt get blue but the field is aligned left...

 

any idea how I can solve this? thanks 

Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008

Re: Focus on bitmap in a HorizontalFieldManager

Hi,

 

So what exactly do you want.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
yann247
Posts: 96
Registered: ‎03-06-2009

Re: Focus on bitmap in a HorizontalFieldManager

I want to use a bitmapfield as a button, aligned right.

 

I made the bitmap focusable, put it in a HFM and set its style as DrawStyle.RIGHT.

 

When I focus the button, the whole line becomes BLUE (as if the whole line was focus, not just the bitmap).

I dont want the whole line to get blue. 

Please use plain text.
Developer
yann247
Posts: 96
Registered: ‎03-06-2009

Re: Focus on bitmap in a HorizontalFieldManager

[ Edited ]

 

 

 

Message Edited by yann247 on 05-08-2009 10:40 AM
Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008

Re: Focus on bitmap in a HorizontalFieldManager

Hi,

 

Then make the size of your HorizontalFieldManager() equal to your bitmapField.

 

You can do this in this way

 

 HorizontalFieldManager rowManager = new HorizontalFieldManager(){
                 
                  public void sublayout(int width, int height){
                      super.sublayout(LooknFeel.WIDTH,Bitmap.getBitmapResource("signin.png").getHeight());
                      setExtent(LooknFeel.WIDTH,Bitmap.getBitmapResource("signin.png").getHeight());
                  }
                 
                 
                  public void paint(Graphics g){
                           g.setBackgroundColor(Color.BLACK);
                           g.fillRect(0,0,LooknFeel.WIDTH,getHeight());
                           g.clear();
                           super.paint(g);
                      }
           
        };

 

Here I had only set the height according to my bitmap you have to set both width and heigth.

 

 

Please let me know if it solved your problem or not.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
yann247
Posts: 96
Registered: ‎03-06-2009

Re: Focus on bitmap in a HorizontalFieldManager

Great, thanks
Please use plain text.
Developer
yann247
Posts: 96
Registered: ‎03-06-2009

Re: Focus on bitmap in a HorizontalFieldManager

Actually I have a little problem, I wanted to align the field right but I also wanted a gray background for the WHOLE line,

so I tried adding the small HFM to a USE_ALL_WIDTH HFM with a background color but I cannot get the field alignes right:

 

 

HorizontalFieldManager bgHfm = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH) { protected void paint(Graphics graphics) { graphics.setBackgroundColor(0xe5e5e5); graphics.clear(); super.paint(graphics); } }; HorizontalFieldManager imageHfm = new HorizontalFieldManager(Field.FIELD_RIGHT) { public void sublayout(int width, int height){ super.sublayout(buttonWidth, buttonHeight); setExtent(buttonWidth, buttonHeight); } };

 

 

 

Please use plain text.