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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Contributor
Posts: 24
Registered: ‎05-19-2011
My Device: Blackberry storm
My Carrier: verizon

Horizontalfieldmanager inside verticalfieldmanger for centering the fields (x position of the first field)

Hi

 

I am working on tooltip of tab button. I want position the tooltip and I got one issue.

 

 

The issue is I have five button with 47*47 dimension image. And I make center by

 

 


  _tabManager =new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER)                _tabManager.setBackground(BackgroundFactory                .createSolidBackground(0x0000FF00));                        VerticalFieldManager vfmCentre = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH);  

vfmCentre.setBackground(BackgroundFactory                .createSolidBackground(0x0000FF00));  

 

            _tab1.setMargin(2,10,0,0);       

_tabManager.add(_tab1);       

 _tab2.setMargin(2,10,0,0);     

  _tabManager.add(_tab2);   

      _tab3.setMargin(2,10,0,0);   

    _tabManager.add(_tab3);       

  _tab4.setMargin(2,10,0,0);     

  _tabManager.add(_tab4);      

    _tab5.setMargin(2,0,0,0); 

      _tabManager.add(_tab5);     

        System.out.println("Width"+_tabManager.getPaddingLeft());       

        vfmCentre.add(_tabManager);     

  add(vfmCentre);

 

 

Can anybody please suggest if putting Horizontalfieldmanager inside verticalfieldmanger for centering the fields. How we calculate the starting point(x postion) of the first field in  Horizontalfieldmanager ?

 

 

Thanks in advance.

 

 

Regards,

Sathish

Contributor
Posts: 24
Registered: ‎08-04-2010
My Device: Not Specified

Re: Horizontalfieldmanager inside verticalfieldmanger for centering the fields (x position of the first field)

You can get hold of the 1st field of HorizontalFieldManager within the VerticalFieldManager by using the following code

 

Manager tempManager = (Manager) vfmCentre.getField(0);

//This returns the HorizontalFieldManager _tabManager in ur case

 

int xPosition = tempManager.getField(0).getContentLeft();

//This should ideally return the x co-ordinate of the first field in the horizontal manager

 

Havent tried it, but I guess this should work!

 

Regards

Suhas

 

 

Developer
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel

Re: Horizontalfieldmanager inside verticalfieldmanger for centering the fields (x position of the first field)

you can redefine the height and the width for the horizontalfieldmanager and verticalfieldmanager by override the subayout method and the will help u to centering the fields.
Contributor
Posts: 48
Registered: ‎05-26-2011
My Device: Bold 9700
My Carrier: Telkomsel

Re: Horizontalfieldmanager inside verticalfieldmanger for centering the fields (x position of the first field)

You may use recursive to calculate position of your tooltips. Below is piece of code from my project, hope could suitable with you too.

	protected XYPoint getTooltipPoint(Field field, int x, int y) {
		XYRect rect = field.getContentRect();
		XYPoint point = new XYPoint(x + rect.x, y + rect.y);

		if (field.getManager() != null) {
			point.y -= field.getManager().getVerticalScroll();
		}

		if (field instanceof Manager) {
			Manager manager = (Manager) field;
			return getTooltipPoint(manager.getFieldWithFocus(), point.x,
					point.y);
		} else {
			return point;
		}
	}