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
Contributor
rfwalker
Posts: 44
Registered: ‎07-27-2010
My Device: Tour
Accepted Solution

OneLineTextField and border don't display correct together

[ Edited ]

Hi all, i need a tabbed container and found the example of pill buttons which look awesome

and can function as tabs, (from the "Implement advanced buttons, fields, and managers" article) 

so I am using them in my app.

 

let me say, they look great, thanks so much for creating that 

 

then in one of the 'tabs', I have laid out

a search field (OneLineTextField) followed by the results (ObjectListField ) below it

 

but my search field is not getting drawn correctly (see pic)

 

seems the border get cut off on the right, and trying to make it smaller

seems to be ignred. I am running api 5 with simulator 5.0.0519 ( or is it 591)

 

any help on how I can get this to look like I would expect, also, also, where is the

underline being set in OneLineTextField being set, i guess this is when it thinks a

mispelled word is there.

 

I'd like to show a remove that effect and just get it to lok more professional

 

OneLineTextField searchOneLineTextField = new OneLineTextField("Search:", "");        
XYEdges padding = new XYEdges(2,2,2,2);
Border roundedBorder = BorderFactory.createRoundedBorder(padding, Border.STYLE_SOLID);

searchOneLineTextField.setBorder(roundedBorder);
       
       
        add( new LabelField("testing screen") );
        add( new SeparatorField() );
        add(searchOneLineTextField);

 

 

you guys are great in here, without being able to read through this, i'd never get this app for my work complete

 

 

2828i951BB8CCD6606B03

 

FYI: I got the  OneLineTextField from here

http://supportforums.blackberry.com/t5/Java-Development/Sample-Code-Scrollable-one-line-text-input-f...

 

and the "Implement advanced buttons, fields, and managers" example from

http://supportforums.blackberry.com/t5/Java-Development/Implement-advanced-buttons-fields-and-manage...

 

 

 

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Advanced Buttons/Fields/Managers demo + OneLineTextField example don't display correct together

Too bad I can't (yet, at least) see your picture.  I know that there is no "underline" in OneLineTextField, though, so that must be coming from the "advanced buttons, fields and managers".

 

What manager are you using as the container for those two fields?  How do you add them?  Small details might greatly change the behaviour...

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Contributor
rfwalker
Posts: 44
Registered: ‎07-27-2010
My Device: Tour

Re: Advanced Buttons/Fields/Managers demo + OneLineTextField example don't display correct together

hmm, i can see pic, but here it is

http://www.akersacademy.com/images/robert/image3.png

 

the EditField does draw a border on the right side like one expect even if

the screen shot does not show it, but the OneLineTextField does not

 

[code]

OneLineTextField searchOneLineTextField =

new OneLineTextField("Search (OneLineTextField):", "");

 

XYEdges thickPadding = new XYEdges(2,2,2,2);

Border roundedBorder = BorderFactory.createRoundedBorder(thickPadding, Border.STYLE_SOLID);

searchOneLineTextField.setBorder(roundedBorder);

 

add(searchOneLineTextField);

 

add( new LabelField(" ") );

 

LabelField l1 = new LabelField("Search (EditField): ", Field.FIELD_VCENTER);

 

EditField editField = new EditField("", null, 20, EditField.NO_NEWLINE | EditField.FOCUSABLE |   EditField.EDITABLE);

 

XYEdges edges = new XYEdges(2,2,2,2);

Border roundedBorder2 = BorderFactory.createRoundedBorder(edges, Border.STYLE_SOLID);

editField.setBorder(roundedBorder2);

 

HorizontalFieldManager m = new HorizontalFieldManager();

m.add(l1);

m.add(editField);

add( m );

[code]

 

the add is being added directly to a MainScreen, so i guess that would be using

Vertical manager

 

thanks for replying

 

 

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Advanced Buttons/Fields/Managers demo + OneLineTextField example don't display correct together

Oh, now I can see the image as well (sometimes they take some time (pun intended) to "materialize" for other members here).  I see your problem - hmm, that's curious.

 

Now, the interesting thing is - how did you manage to create a OneLineTextField using (String, String) constructor?  Are you sure this is your full code?

 

Does your parent Manager (the one to which you add(searchOneLineTextField)) have HORIZONTAL_SCROLL set?  If it does, your OneLineTextField might extend past the visible right boundary and thus rounded corners on the right will not be visible.  Can you type a lot of characters there and observe the behavior?

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Contributor
rfwalker
Posts: 44
Registered: ‎07-27-2010
My Device: Tour

OneLineTextField and border don't display correct together

[ Edited ]

 i was able to get it to work but not really happy because to me, both are the same

yet one requires more code and is not encapsulating the border, i basically

always want a border around the OneLineTextField

 

 

 

one version i used is using OneLineTextField right out of the box , no changes to it but

this requires the border setup and layout in the current code location,

i'd like to encapsulate the border into my own OneLineTextField so it

just happens automagically. (see below for version not working)

 

(this works, show editfield with no clipping so i see right hand border)

 

my usage from the main screen is

 

OneLineTextField searchOneLineTextField =
         new OneLineTextField("", "", 20, EditField.FIELD_VCENTER);
XYEdges thickPadding = new XYEdges(2,2,2,2);
Border b = BorderFactory.createRoundedBorder(thickPadding, Border.STYLE_SOLID);
searchOneLineTextField.setBorder(b);       
LabelField l =

       new LabelField("Search (OneLineTextField): ", Field.FIELD_VCENTER);                       
 HorizontalFieldManager m1 = new HorizontalFieldManager();
m1.add(l);  
m1.add(searchOneLineTextField);
add( m1 );

 

 

now if I use OneLineTextField as template, and make a MyOneLineTextField class

where I change no other code except add below crating the EditField

 

 

// adding this additional boder code

XYEdges thickPadding = new XYEdges(2,2,2,2);
Border b= BorderFactory.createRoundedBorder(thickPadding, Border.STYLE_SOLID );
_editField.setBorder(b);

 

so that MyOneLineTextField.java is

 

(this does not show border and appears to let editfield run off the screen)

 

 

public MyOneLineTextField(String label,
                      String initialValue,
                      int maxChars,
                      long style)
    {
        super(NO_HORIZONTAL_SCROLL);
       
        HorizontalFieldManager textMgr =
             new HorizontalFieldManager(HORIZONTAL_SCROLL);
       
        add(new LabelField(label));
       
        _editField = new EditField("",  initialValue,  maxChars,
                                             style | EditField.NO_NEWLINE |
                                              EditField.FOCUSABLE | EditField.EDITABLE);
       
        XYEdges thickPadding = new XYEdges(2,2,2,2);
        Border b= BorderFactory.createRoundedBorder(thickPadding, Border.STYLE_SOLID );
        _editField.setBorder(b);       

               
        textMgr.add(_editField);
       
        add(textMgr);
       
    }

 

 

my usage on this above code from the main screen is

 

MyOneLineTextField searchOneLineTextField =

                 new MyOneLineTextField("Search (MyOneLineTextField): ",

                 "",

                 20,

                 EditField.FIELD_VCENTER);

 

add(searchOneLineTextField);

 

 

2853i9F249536C4A1C974

 

 

 

 

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Advanced Buttons/Fields/Managers demo + OneLineTextField example don't display correct together

I guess I know what's happening.  Your inner editField which you are trying to encapsulate into a border is inside a scrolling horizontal field manager.  textMgr, that is.  So its border goes to the end of its virtual size (which is waaay too big - DEFAULT_MAXCHARS is a million!).  Try textMgr.setBorder instead of _editField.setBorder and you should be in much better shape.

 

Sorry for not figuring that out earlier :smileysad:

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Contributor
rfwalker
Posts: 44
Registered: ‎07-27-2010
My Device: Tour

OneLineTextField and border don't display correct together

[ Edited ]

u blackberry developers are the most helpful and nice engineers i have ever dealth with.

I am just waiting for some sarcastic response while I read all these

posts and never a short tempered response, great job team,

 

ur solution worked like a champ