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


Pyle 5.2-Channel Hi-Fi Bluetooth Stereo Amplifier PT694BT 1000 Watt picture

Pyle 5.2-Channel Hi-Fi Bluetooth Stereo Amplifier PT694BT 1000 Watt

$139.95



Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker picture

Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker

$14.99



Biamp Tesira AMP-450BP AVB/TSN Enabled 4 Channel Amplifier w/ PoE+ (G155) picture

Biamp Tesira AMP-450BP AVB/TSN Enabled 4 Channel Amplifier w/ PoE+ (G155)

$250.00



KEYENCE LR-TB5000CL Laser Sensor with Built-in Amplifier picture

KEYENCE LR-TB5000CL Laser Sensor with Built-in Amplifier

$289.99



Traction Amplifier 1239519/003 Raymond EPJ picture

Traction Amplifier 1239519/003 Raymond EPJ

$225.00



New Phoenix Contact MACX MCR-UI-UI-NC 2811446 Isolation Amplifier picture

New Phoenix Contact MACX MCR-UI-UI-NC 2811446 Isolation Amplifier

$285.00







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