09-16-2009 12:21 AM
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();
for(int i=0; i<iNumFields; i++)
Field field = this.getField(i);
YPosition = YPosition + 48;
if (i == 4)
XPosition = XPosition + 48;
YPosition = 0;
setExtent (96, 240);
09-16-2009 03:58 AM
09-16-2009 01:14 PM
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.
09-17-2009 02:41 PM
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.
09-17-2009 04:24 PM
09-17-2009 06:03 PM
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.
09-17-2009 06:33 PM