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
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Horziontalfield manager highlight on click

I was workign with listfield, which on click i had  drawfocus function to highlight clicked region

 

 protected void drawFocus(Graphics graphics, boolean on) {
		  XYRect rect = new XYRect();
		  
		  getFocusRect(rect);
		  if (on) {
		 // graphics.setColor(Color.YELLOW);
		 // graphics.fillRect(rect.x, rect.y, rect.width, rect.height);
		  //getCallback().drawListRow(this, graphics, getSelectedIndex(), rect.y, rect.width);
			  
			  drawHighlightRegion(graphics, HIGHLIGHT_FOCUS, on, rect.x, rect.y, rect.width, rect.height);
		     //    int prevColor = graphics.getColor();
			// graphics.setColor(Color.PURPLE);
		//	 graphics.drawRect(rect.x, rect.y, rect.width, rect.height);
			// graphics.fillRect(rect.x, rect.y, rect.width, rect.height);
			// graphics.setColor(prevColor);
			 getCallback().drawListRow(this, graphics, getSelectedIndex(), rect.y, rect.width);
			 
		  }
	  } 

 

 

I want to do same for a horizontalfield manager, onclick or onfocus do the same

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Horziontalfield manager highlight on click

If I do this, And I go down by arrows it does funcgion i want. but it doesnt onclick of the horizontalfieldmanager

protected void paint(Graphics g) {
g.setBackgroundColor(isFocus() || ? Color.BLUE : Color.WHITE);
g.clear();
super.paint(g);
}




Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Horziontalfield manager highlight on click

usually the manager itself is not focusable, but a field within is.
i would suggest that you draw it as focused depending on the status of its fields.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter