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
New Developer
Posts: 17
Registered: ‎05-15-2009
My Device: Not Specified
Accepted Solution

Problem with the H and V fieldmanager :S

[ Edited ]

Hi to everybody!! ;D

Im new in this forum and i want to ask a thing.

I want to insert 3 BitmapFields on the screen but with a special organization, these should be placed as follow.

I know that i must do it with horizontal and vertical field manager's but i don't know how >_<

If any can help me i will always be grateful with him :smileyvery-happy:

 

 http://www.freeimagehosting.net/uploads/ae64a41495.jpg

 

PD: Below each image must be a RichtextField aaaaaand the version are blackberry 8120  4.5.0 >_<

 

Message Edited by boogeyman on 05-15-2009 05:02 PM
Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem with the H and V fieldmanager :S

1) Does the text have to be restricted to the 'width' of the image which it appears to be captioning?

 

2) Are the last two images the same size?

 

3) Do you have any special requirement for the way that focus will flow?

 

4) How will this look on a Storm in Landscape format?

New Developer
Posts: 17
Registered: ‎05-15-2009
My Device: Not Specified

Re: Problem with the H and V fieldmanager :S

1- the text should be exactly below each image (more or less :smileytongue:)

 

2- yeah, the 3 icons have the same size.

 

3- the BitmapField are links to web pages.

 

4- i still thought about it >_< i only want to do this for the normal format.

 

New Developer
Posts: 19
Registered: ‎04-09-2009
My Device: Not Specified

Re: Problem with the H and V fieldmanager :S

Outer V0

     Inner V1

         Image

         Label

     Inner H0

        Inner V2

            Image

            Label

        Inner V3

            Image

            Label

 

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

Re: Problem with the H and V fieldmanager :S

rboatright has summarised pretty much my thoughts, but I would add:

 

- Don't think you need the outer V0

- Center all Images

- override layout on all the Labels (which I would make unfocusable RichTextField), to set Width to the width of the images

- centre all Labels

- Restrict width of V2 and V3 to Display.getWidth()/2

 

job done....

 

New Developer
Posts: 17
Registered: ‎05-15-2009
My Device: Not Specified

Re: Problem with the H and V fieldmanager :S

Thanks for your help ;D

You have helped me a lot and this is the final code

Bitmap balon = Bitmap.getBitmapResource("icono_periodicodep.jpg"); final BitmapField Balon = new BitmapField(balon, BitmapField.FIELD_HCENTER); LabelField t1 = new LabelField("Diarios Deportivos", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE); Bitmap avion = Bitmap.getBitmapResource("icono_avion.jpg"); final BitmapField Avion = new BitmapField(avion, BitmapField.FIELD_HCENTER); LabelField t2 = new LabelField("Lineas Aereas", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE | LabelField.ELLIPSIS); Bitmap periodico = Bitmap.getBitmapResource("icono_periodico.jpg"); final BitmapField Periodico = new BitmapField(periodico, BitmapField.FIELD_HCENTER); LabelField t3 = new LabelField(" Diarios Generales", LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE | LabelField.ELLIPSIS); HorizontalFieldManager hfm = new HorizontalFieldManager(); VerticalFieldManager vfm1 = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH); VerticalFieldManager vfm2 = new VerticalFieldManager(){ protected void sublayout(int maxWidth,int maxHeight){ super.sublayout(Display.getWidth()/2, this.getPreferredHeight()); super.setExtent(Display.getWidth()/2, this.getPreferredHeight()); } }; VerticalFieldManager vfm3 = new VerticalFieldManager(){ protected void sublayout(int maxWidth,int maxHeight){ super.sublayout(Display.getWidth()/2, this.getPreferredHeight()); super.setExtent(Display.getWidth()/2, this.getPreferredHeight()); } }; add(vfm1); vfm1.add(Balon); vfm1.add(t1); add(hfm); hfm.add(vfm2); hfm.add(vfm3); vfm2.add(Avion); vfm2.add(t2); vfm3.add(Periodico); vfm3.add(t3);

 

 

It's work perfectly :smileyvery-happy: