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: 107
Registered: ‎08-08-2008
My Device: Not Specified

Simulating buttons using bitmap on Storm touch screen

I have an old app thats working with 8300, 8800, 9000 that uses bitmaps as buttons. Using getLeafFieldWithFocus and trackwheelClick i can push new screens depending on which bitmap field has focus.

 

I'm trying to update the app to work on the Storm and have reviewed the TouchEvent and TouchGesture class but I still can't figure out how the touchEvent(TouchEvent message) gets fired so i can push a new screen.

 

I'm compiling a CLDC app that extends UiApplication and the touchEvent looks something like this.

 

 

public boolean touchEvent(TouchEvent message) { int eventCode = message.getEvent(); if(eventCode == TouchEvent.CLICK) { if ( whatFieldFocus == bitmapField1 ) { try { UiApplication.getUiApplication().pushScreen(new Screen1()); } catch( Exception e) { System.out.println(e); } } else if ( whatFieldFocus == bitmapField2 ) { try { UiApplication.getUiApplication().pushScreen(new Screen2()); } catch( Exception e) { System.out.println(e); } } else if ( whatFieldFocus == bitmapField3 ) { try { UiApplication.getUiApplication().pushScreen(new Screen3()); } catch( Exception e) { System.out.println(e); } } } return true; }

 

Does this code look okay?
 

 

Developer
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: Simulating buttons using bitmap on Storm touch screen

figured this out. lots of changing in my UI for the new OS.
New Developer
Posts: 1
Registered: ‎12-17-2008
My Device: Not Specified

Re: Simulating buttons using bitmap on Storm touch screen

Could you please shed some light on how you did it?  Thanks a lot!
Developer
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: Simulating buttons using bitmap on Storm touch screen

I extended the bitmapfield like so:

BitmapField bitmapField = new BitmapField(bmImage,BitmapField.FOCUSABLE ) { protected boolean navigationClick(int status, int time) { try { UiApplication.getUiApplication().pushScreen(new MyScreen()); } catch( Exception e) { System.out.println(e); } return true; } };

 

seems to be working fine so far.