BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 11-13-2009, 05:02 AM   #1 (permalink)
New Member
Join Date: Nov 2009
Model: 8520
Carrier: Airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Issue with Custom Text Field

Please Login to Remove!

I am new to BB development(have been working on it for 3-4 days) and i am stuck with a problem. Here are the details of my IDE.
I am using JDE 4.2.1 and running bb 8800 simulator.

My Project:
I need to display bitmaps on a text field, be it basicedit, edit, richtext.
I am extending EditField:

public class CustomTextField extends  EditField implements KeyListener
and overriding the paint method and here is my main logic of drawing the bitmaps using g.drawBitmap

protected void paint(Graphics g)
   g.drawBitmap(x, y, bitMap.getWidth(), bitMap.getHeight(),bitMap, 0, 0);

I am creating a VerticalFieldManager and adding an instance of my CustomTextField:
manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.VERTICAL_SCROLLBAR);
 CustomTextField c2= new CustomTextField("T2:", "", 100,EditField.FOCUSABLE|EditField.FILTER_DEFAULT|EditField.FIELD_LEFT,30);
With this much code only one line of my field is available, meaning when i draw bitmaps and i reach the end of the line, no new line gets inserted and i am still able to draw, or better, insert new bitmaps but they are not visible. But if i override layout:

protected void layout(int width, int height)
I can view more lines but i am not able to scroll past the visible area.

Any advice/suggestions/hints as to how to view past the visible area will be greatly appreciated.
Also, the edit fields default behavior is that when the inserted/typed text reaches the end of the line a new line gets inserted, pushing other fields below it down 1 line. I havent been able to provide this feature with my custom field. I would like to know how to do this.

I hope someone can help me out here.
Thanks in advance!


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