BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-01-2008, 07:01 AM   #1
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Default Custom ButtonField doesnt paint

Please Login to Remove!

Ive override the paint method at my CustomButtonField, but it's never called.

Whats the problem?

Thanks.
Offline  
Old 12-01-2008, 10:20 AM   #2
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

my paint method is always called.
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Old 12-01-2008, 10:49 AM   #3
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Default

Code:
public class EscaladosButton extends Field {

	private TarifaDTO tarifa;

	private Bitmap button;
	private Bitmap on;
	private Bitmap off;
	private int fieldHeight;



	public EscaladosButton(TarifaDTO tarifa) {		
		
		super(Manager.FOCUSABLE);
		on = Bitmap.getBitmapResource("escalados_icon.jpg");
		off = Bitmap.getBitmapResource("escalados_icon.jpg");
		fieldHeight = on.getHeight();
		this.tarifa = tarifa;
		button = off;	
		invalidate();		
	}

	public EscaladosButton() {
		super(Field.FOCUSABLE);

		button = off;

	}
	protected void onFocus(int arg0) {
		button = on;
		super.onFocus(arg0);
	}
	protected void onUnfocus() {
		button = off;
		super.onUnfocus();
	}
	
	protected void drawFocus(Graphics g, boolean arg1) {
		g.drawBitmap(0, 0, 0, fieldHeight, button, 0, 0);	
	}



	protected void paint(Graphics arg0) {
		arg0.drawBitmap(0, 0, 0, fieldHeight, button, 0, 0);
	}

	public TarifaDTO getTarifa() {
		return tarifa;
	}

	public void setTarifa(TarifaDTO tarifa) {
		this.tarifa = tarifa;
	}

	protected void layout(int arg0, int arg1) {
		// TODO Auto-generated method stub
		
	}

}
Here is my code.
Offline  
Old 12-01-2008, 11:04 AM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Not a good idea to override layout() and then not implement it. remove this override or do a correct implementation, otherwise you extent will be 0,0.

Also, you should probably override isFocusable() and return true.
Offline  
Old 12-01-2008, 11:59 AM   #5
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Default

Quote:
Originally Posted by Dougsg38p View Post
Not a good idea to override layout() and then not implement it. remove this override or do a correct implementation, otherwise you extent will be 0,0.

Also, you should probably override isFocusable() and return true.
It's a request for extends Field class.

Thanks for your answer.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


ORTEC NIM BIN 7 SLOT MAINFRAME CHASSIS   (ZIG7) picture

ORTEC NIM BIN 7 SLOT MAINFRAME CHASSIS (ZIG7)

$150.00



Tektronix 7904 Oscilloscope Mainframe  w/ 2x 7A26 2x 7B92A Modules picture

Tektronix 7904 Oscilloscope Mainframe w/ 2x 7A26 2x 7B92A Modules

$399.97



National Instruments NI PXI-1044 Chassis 14-Slot PXI Mainframe 189105E-01 Rev 01 picture

National Instruments NI PXI-1044 Chassis 14-Slot PXI Mainframe 189105E-01 Rev 01

$199.99



SHC SYSTEM 6 MAINFRAME + Mixed Modules 6-562,6-201,6-402. picture

SHC SYSTEM 6 MAINFRAME + Mixed Modules 6-562,6-201,6-402.

$83.99



Chroma 6312 DC Electronic Load Mainframe  picture

Chroma 6312 DC Electronic Load Mainframe

$239.96



ILX Lightwave LDC3908 Laser Diode Controller Mainframe with Key picture

ILX Lightwave LDC3908 Laser Diode Controller Mainframe with Key

$480.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.