BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-15-2007, 08:18 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom editfield query

Please Login to Remove!

I have created a custom edit field.The code for the following is given below.
My problem is the when i try to set a background color to it,i cant c the focus.So i include the drawFocus mtd and draw a focus.But now this focus does not move with the cursor.so how do i make the focus move with the cursor?please help me....

Code:
username  = EditField("","",10,EditField.EDITABLE|
                                        EditField.FIELD_HCENTER|) {
             
        public int getPreferredWidth() {
            defaultFont = Font.getDefault();       
            text = "000000000000";
            return defaultFont.getAdvance(text);
        }        
        protected void layout(int width, int height) {
            width = getPreferredWidth();
            height = super.getPreferredHeight();
            super.layout(width, getHeight());
            super.setExtent(width,getHeight()); 
        }        
        protected void paint(Graphics graphics) {           
            graphics.drawRect(1,1, getPreferredWidth() , getHeight());
            graphics.setBackgroundColor(Color.WHITE);
            graphics.clear();
            super.paint(graphics);
        }
       protected void drawFocus(Graphics graphics, boolean on) {
            graphics.invert(0,0,1,getHeight());            
        };
Can someone please give some ideas how to do it?/
__________________
Thanks
Meenal

Last edited by Meenal : 06-18-2007 at 12:35 AM.
Offline  
Old 06-15-2007, 08:35 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

if you just want to change the color you can try
this.focusColour = 0x00FFD700;
this.unfocusColour = Color.WHITE;
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 06-18-2007, 12:34 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Simon,
What i really want is that the cursor should be visible.which is not happening.
How can i make the cursor visible?
__________________
Thanks
Meenal
Offline  
Old 09-11-2007, 03:56 PM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

bump, I'm having the same problem. Oddly enough it occurs only on the 8830 sim, not the 8703e
Offline  




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