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
akhilmuppa
Posts: 41
Registered: ‎11-18-2012
My Device: blackberry sms message making
My Carrier: 9951111450
Accepted Solution

How to Develop BlackBeery Ui

i want to develop Ui for a Screen which i have attached ..please any on ehelp me to write code for uiscreen3.jpg

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Develop BlackBeery Ui

Sorry can't see it very well.  Any chance of anything bigger?

 

Ui can be difficult on BlackBerry if you try to create something special.  Here are some useful Fields that might help you.

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

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: How to Develop BlackBeery Ui

[ Edited ]

How familiar are you with BlackBerry programming? You can achieve more or less complicated screen layouts depending on that.

 

I see the following elements on your screen:

1) Top area (presumably non-scrollable so that when the main area scrolls it stays in place - is that correct?) with a text entry box and a button;

2) Main Area - right now it's gray so I have no idea what you want to display there. Will it scroll on some occasions? What will it display?

3) Bottom area - again, presumably non-scrollable - with three evenly spaced buttons.

 

First of all, this screen divison into three areas/regions just begs to use MainScreen as your top-most container. You set the Managers implementing the top and the bottom as MainScreen's banner and status, respectively. Read more here:

MainScreen explained

The middle area will be filled by the Managers/Fields added directly to the screen.

 

Your header is where your problems begin. By default text-input fields (TextField and its descendants such as EditField) grab all the width given to them, so if you just add, say, an EditField and a ButtonField to a HorizontalFieldManager, your button will not have any room for it and will not show on the screen. The term I often use to describe it is "width-hungry" - if you search forums for that exact pair of words you'll find enough posts with solutions. If not, ask here again.

 

The bottom part of the screen is not implemented by any built-in Manager, but there is a wonderful package of useful advanced UI gadgets - Advanced buttons, fields, and managers. Look for JustifiedEvenlySpacedHorizontalFieldManager there - it is exactly what you need for such a layout.

 

Good luck!

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Contributor
akhilmuppa
Posts: 41
Registered: ‎11-18-2012
My Device: blackberry sms message making
My Carrier: 9951111450

Re: How to Develop BlackBeery Ui

Main Area is a text area and it will scroll vertical and horizontal..

 

Yeahh really i have problem with header i tried in many ways with many managers but it is not displaying both textfielld and button .so please help me to solve this problem..As i reffered some docs but i dint get the solution

Please use plain text.
Developer
Dionysus
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900
My Carrier: MTN

Re: How to Develop BlackBeery Ui

The text box will take up the entire available width so you will have to override the sublayout to accomodate the button and give the remaining width to the textbox to be laid out.

Please use plain text.
Contributor
akhilmuppa
Posts: 41
Registered: ‎11-18-2012
My Device: blackberry sms message making
My Carrier: 9951111450

Re: How to Develop BlackBeery Ui

yeahh but am not able to override the sublayout.Can you explain me in detail pelase...

 

Please use plain text.
Developer
simon_hain
Posts: 16,017
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: How to Develop BlackBeery Ui

this should explain it to you:
http://supportforums.blackberry.com/t5/Java-Development/How-to-Extend-Manager/ta-p/446749
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: How to Develop BlackBeery Ui


akhilmuppa wrote:

Main Area is a text area and it will scroll vertical and horizontal..

 

Yeahh really i have problem with header i tried in many ways with many managers but it is not displaying both textfielld and button .so please help me to solve this problem..As i reffered some docs but i dint get the solution


OK, then you create your MainScreen with both VERTICAL_SCROLL and HORIZONTAL_SCROLL flags. The main area Manager (which is not directly visible to you though you can get the reference via getMainManager) is a VerticalFieldManager, so it will arrange the fields vertically (duh!). However, thanks to the HORIZONTAL_SCROLL flag, it will allow fields wider than the screen to get what they want and will be able to scroll horizontally - either programmatically (setHorizontalScroll) or "naturally" when the focus moves outside of the visible area.

 

As for the problem with the TextField and the button, there are two ways to solve it.

 

For example, if you searched for "width-hungry" as I suggested, you would have found, say, this thread:

editfield and checkboxfield on same line

Take a look at the solution - this is one of the ways to do it: just create a field which will limit itself with how much room it can take.

 

The second solution would be to create a custom manager for this specific setup of TextField on the left and ButtonField on the right. The manager will always have exactly two fields, in this exact order, so you can write its sublayout relying on it.

So, what does protected void sublayout(int maxWidth, maxHeight) do? It does the following things:

1) Receives the maximum width and height it can occupy within the parent manager (see maxWidth and maxHeight parameters);

2) Tells the Manager's children (managed fields) how much room within this Manager they can get (using layoutChild(Field child, int width, int height)). After that (and only after that) it can find out how much that child will actually occupy using child.getExtent (any form) or (if you want width and height separately) child.getWidth()/child.getHeight(). It is normal for any Manager to lay out one child, get its dimensions, adjust the remaining width and height according to this information and then continue laying out children in the same way.

3) Positions its children using setPositionChild(Field child, int x, int y) call. The positions are relative to its left upper corner (which is (0,0)).

4) Calculates its resulting width and height and sets them using setExtent(int widht, int height).

 

Try to write the Manager using this information along with the link Simon provided and come back here if you still have problems. By the way, take a look at JustifiedEvenlySpacedHorizontalFieldManager's sublayout for a good example.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.