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: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone
Accepted Solution

custom textboxfield issue in os 6.0

Hi,

I have made one custom textboxfield(editfield) which has background image.It works fine till os5.0 but in os 6.0 I am getting image overlapping problem while scrolling through text in the editfield.Can somebody help me please?

Rujuta Trivedi
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: custom textboxfield issue in os 6.0

Can you share the code painting the background?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: custom textboxfield issue in os 6.0

[ Edited ]

Here is my code:
public class TextBoxField extends HorizontalFieldManager {
    Bitmap draw;
    Bitmap resized;
    int maxChars;
    boolean flag;
    
    private int managerWidth;
    private int managerHeight;
    private EditField editField;
    private String strImg;
    private boolean num;

    
    public TextBoxField(int width, int height, String initialValue,
            int maxNumChars, long style, boolean _flag, String img,
            boolean numeric) {

        super(Manager.NO_VERTICAL_SCROLL);
        draw = Bitmap.getBitmapResource(img);
        managerWidth = width;
        managerHeight = height;
        flag = _flag;
        this.strImg = img;
        this.num = numeric;
        
        HorizontalFieldManager vfm = new HorizontalFieldManager(
                Manager.HORIZONTAL_SCROLL);

        editField = new EditField("", initialValue, maxNumChars, style
                | EditField.NO_NEWLINE) {
            

           
        };

        vfm.add(editField);
        add(vfm);
    }

    

    protected void paintBackground(Graphics g) {
        super.paintBackground(g);
        
            g.drawBitmap(0, 0, managerWidth, managerHeight, draw, 0, 0);
    }

    
    public void sublayout(int width, int height) {
        if (managerWidth == 0) {
            managerWidth = width;
        }

        if (managerHeight == 0) {
            managerHeight = height;
        }

        super.sublayout(managerWidth, managerHeight);
        
        setExtent(managerWidth, managerHeight);
    }

    
    public String getText() {
        return editField.getText();
    }

    public void setText(String text) {
        editField.setText(text);
    }
}

Rujuta Trivedi
Highlighted
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: custom textboxfield issue in os 6.0

 

protected void paintBackground(Graphics g) {
  super.paintBackground(g);
        
  g.drawBitmap(getHorizontalScroll(), getVerticalScroll(), managerWidth, managerHeight, draw, 0, 0);
}

 

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: custom textboxfield issue in os 6.0

Thanks a lot,

Its working

Rujuta Trivedi
Developer
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: custom textboxfield issue in os 6.0

Hi,

That code worked on the screen which hasn't any background image.But not on with background image,I mean its not working in the condition when the textbox has a bg and the screen in which that textbox is placed has a BG.Please guide me

Rujuta Trivedi
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: custom textboxfield issue in os 6.0

Isn't working is not a good definition of the problem. What do you see and how it differs from what you expect?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: custom textboxfield issue in os 6.0

Its working fine on without bg screen(doesn't overlap image while scrolling within custom textbox) but it does overlap image in textboxfield when the screen has bg
Rujuta Trivedi
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: custom textboxfield issue in os 6.0

I still don't understand what exactly is going wrong. Can you post a screenshot illustrating the problem?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: custom textboxfield issue in os 6.0

textboxbug.png

 

 

Here is the problem,see the overlapping image(left corner) in username textfield .I am getting problem in os 6 only otherwise its working fine

Rujuta Trivedi