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
PIN: N/A
Carrier: Airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Issue with Custom Text Field

Please Login to Remove!

Hi.
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:

Code:
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

Code:
protected void paint(Graphics g)
{
.
.
     super.paint(g);
.
.
   g.drawBitmap(x, y, bitMap.getWidth(), bitMap.getHeight(),bitMap, 0, 0);
.
.
}

I am creating a VerticalFieldManager and adding an instance of my CustomTextField:
Code:
manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.VERTICAL_SCROLLBAR);
 CustomTextField c2= new CustomTextField("T2:", "", 100,EditField.FOCUSABLE|EditField.FILTER_DEFAULT|EditField.FIELD_LEFT,30);
manager.add(c2);
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:

Code:
protected void layout(int width, int height)
{
        setExtent(100,100);
}
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!

Regards,
hellcry.
Offline  




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