BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-03-2009, 12:45 AM   #1
Shreyas
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Question How to handle ButtonField & BitmapField Click (Touch) events in Blackberry Storm ?

Please Login to Remove!

I m creating the ButtonField & BitmapFields as

Code:
okButtonField = new ButtonField("Ok", BitmapField.HIGHLIGHT_SELECT | BitmapField.FOCUSABLE); 
startBitmap = Bitmap.getBitmapResource("start.png"); 
startBitmapField = new BitmapField(startBitmap, BitmapField.HIGHLIGHT_SELECT | BitmapField.FOCUSABLE);
Its working with..

Code:
protected boolean touchEvent(TouchEvent event)
{
switch( event.getEvent()  ) 
{
        case TouchEvent.DOWN:  ........
				return true;
        case TouchEvent.MOVE: .......
                                return true;
        case TouchEvent.UP: ........ 
                                return true;   

        case TouchEvent.CLICK:
          if(deleteButton.isFocus())
          {            
            System.out.println("Touched DEL ..........");
          }
          else if(okButton.isFocus())
          {            
            System.out.println("Touched OK ..........");
          }   
	  else if(startBitmapField.isFocus())
          {            
            System.out.println("Touched START ..........");
          }         
        return true;
}
return false;
}
but everytime the same button is invoked which is having focus.

Means if "Ok" button is having focus then even though u clicked on "Delete" button "Ok" button is called.

So how to change the focus on Button Click? means whichever ButtonField or BitmapField is clicked, should get the focus?

is there any method to check "button.isClicked() like button.isFocus() " ?
Offline  
Old 09-04-2009, 01:43 AM   #2
Shreyas
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Question

Do anyone know how to CONSUME_CLICK for BitmapFields like for ButtonField ?

Code:
ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK);
I am creating BitmapField like..

Code:
BitmapField start = new BitmapField(startBitmap, BitmapFieid.FOCUSABLE);
Offline  
Old 09-04-2009, 10:57 PM   #3
Shreyas
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Default

I have overridden touchEvent() but we can set the CONSUME_CLICK property for ButtonField while creating it. Its happening properly.

& for BitmapFields also tochEvents are coming properly. Only I want to know how to set CONCUME_CLICK property for BitmapField as there is no such property while creating BitmapField.
Offline  
Old 09-05-2009, 04:39 AM   #4
Shreyas
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Question

I had created BitmapField as ...

Code:
public class MyCanvas extends MainScreen
{
     BitmapField start = new BitmapField(startBitmap, BitmapFieid.FOCUSABLE);
     ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK | ButtonField.FOCUSABLE);

     hfm.add(start);
     hfm.add(okButton);
}
But there is no property for BitmapField as

Code:
BitmapField.CONSUME_CLICK
to avoid the default menu that comes when clicked on it.

ButtonField has "CONSUME_CLICK" property so we can set for it as

Code:
ButtonField okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK | ButtonField.FOCUSABLE);
The TouchEvents are happening properly by overriding touchevent().
Only I want to set "CONSUME_CLICK" property for BitmapField to avoid the default menu that comes when clicked on it.. How to do it ?

Last edited by Shreyas; 09-05-2009 at 05:08 AM..
Offline  
Old 02-07-2010, 08:07 AM   #5
ricardolecheta
New Member
 
Join Date: Sep 2008
Model: 8300
PIN: N/A
Carrier: do know
Posts: 6
Default

Hi,

have you found a way to do that?

In my project I created a custom button field, and override the touchEvent method.

But every time the method is called in the button with focus, not for the correct button.

Do you have any idea why ?
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


Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker picture

Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker

$14.99



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

KEYENCE LR-TB5000CL Laser Sensor with Built-in Amplifier

$289.99



New In Box ATOS E-MI-AS-IR Proportional Amplifier picture

New In Box ATOS E-MI-AS-IR Proportional Amplifier

$302.12



Honeywell Ultraviolet Flame Amplifier RM7890 A 1015 picture

Honeywell Ultraviolet Flame Amplifier RM7890 A 1015

$199.99



Allen-Bradley Kinetix 5500 20A 3 Phase 190-528VAC Servo Drive (2198-H025-ERS) picture

Allen-Bradley Kinetix 5500 20A 3 Phase 190-528VAC Servo Drive (2198-H025-ERS)

$600.00



REXROTH INDRAMAT ECO-DRIVE DKC02.3-040-7-FW SERVO CONTROLLER *REFURB U.S. SELLER picture

REXROTH INDRAMAT ECO-DRIVE DKC02.3-040-7-FW SERVO CONTROLLER *REFURB U.S. SELLER

$575.00







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