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
Highlighted
Developer
Posts: 266
Registered: ‎04-24-2009
My Device: Not Specified

Set manager position

I know how to set the size/extent of a manager.  How can I set the position of the manager on a screen?

 

I tried setPosition after setExtent but it doesn't work.  I also tried <manager name>.setPosition.

 

    protected void sublayout(int width, int height)
    {       
        int XPosition = 0;
        int YPosition = 0;
        int iNumFields = getFieldCount();

        //super.sublayout(width, height);
 
        for(int i=0; i<iNumFields; i++)
        {
            Field field = this.getField(i);
            layoutChild(field,48,48);
            setPositionChild(field,XPosition,YPosition);
            YPosition = YPosition + 48;
            if (i == 4)
            {
                XPosition = XPosition + 48;
                YPosition = 0;
            }
        }
        setExtent (96, 240);

        setPosition(100,100);
    }

 


Thanks!

Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Set manager position

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...
----------------------------------------------------------
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
Developer
Posts: 266
Registered: ‎04-24-2009
My Device: Not Specified

Re: Set manager position

Thanks for the information, but I'm afraid I'm already familiar with it.

 

I can set the position of the fields within the manager as per the example.  I was trying to set the position of the manager itself.  Perhaps I do not understand how multiple managers work.

 

I want main screen with a horizontal field manag er at the bottom of the screen, andthe default vertical field manager just above it.  I was planning to use the bottom manager to process commands for my menu bar and the verticalfieldmanager to process commands for the "work area".  I had planned to set the extent and position of the managers to accomplish that, but seem unable to do so.

 

If I add a horizontal field manager to a mainScreen that has a default vertical field manager, is the horizontal field manager actually a child of the vertical field manager, or can one be on top of the other, or can they exist side by side?  If it is a child, I could set the size with layoutChild, I just have to figure out which field index it is.  

Developer
Posts: 266
Registered: ‎04-24-2009
My Device: Not Specified

Re: Set manager position

I have been running some experiments and I'm afraid I still do not quite grasp the concept of multiple managers for a single screen. nIt would be nice to really understand what happens with multiple managers on a single screen.

 

I am guessing that creating a main screen that has a default verticalfieldmanager with a  manager added to that mainscreen means the manager is contained within the vertical field manager.  So I would think that adding two managers and using layoutChild to size the managers for certain portions of the screen would allow me to have a manager to process commands for one part of the screen and another manager to process commands for the rest of the screen, while the vertical field manager would see everything the two managers would see.

 

However, if I add on manager my vertical field manager lists one child, and if I use the layoutChild(field,Display.getWidth(),48); command, I get a Uncaught exception thrown - IllegalArgumentException error.

 

It would help me to understand if I am correct in that the vertical field manager could contain two managers that are sized to certain portions of the screen.  If that is the case, how do I size the managers, if I am incorrect, how do multiple filed manager work on a MainScreen?  Even though we set an extent can managers really be sized and positioned.

 

Thanks!!!!

Developer
Posts: 266
Registered: ‎04-24-2009
My Device: Not Specified

Re: Set manager position

I am starting to believe that managers can be sized but not positioned, They just position themselves at the end of the manager above it .

I'm starting to think that the best way to handle menu buttons is to put them on another screen.
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Set manager position

Manager implements Field, and any field can be positioned by it's parent manager.

 

I've done this before, creating a custom field which is in fact a manager (that has a collection of fields), and positioned this manager by placing it in a custom layout manager.

 

So, Yes, a Manager can be positioned.

 

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Set manager position

RexDoug is correct, you will have to implement your own custom manager that allows you to specify where its fields are positioned (includes managers since they are derived from fields).