techie
techie

Reputation: 467

Adding one manager within the other

How to add eyelid field manager to grid field manager.

I have created a grid layout.Now i want to add an eyelid field manager on top of it.

I have been able to add both of them separately but now am unable to use them together.

Following code was used when i wanted to integrate

         _eyelidFieldManager.add(grid);
         add(_eyelidFieldManager);

How else can this be accomplished?

I have also tried adding this way

       grid.add(_eyelidFieldManager);
       add(grid);

But what what i get is the eye lid field manager comes below the grid.I want to superimpose the eyelid on top of grid.So that when i click anywhere on the screen of grid,the eyelid opens.Your help will be appreciated.

Upvotes: 0

Views: 118

Answers (1)

Mister Smith
Mister Smith

Reputation: 28168

EyelidFieldManager has three main methods for adding fields:

  • addTop(Field f): adds a field to the top eyelid.
  • addBottom(Field f): adds a field to the bottom eyelid.
  • add(Field f, int x, int y): adds a field and places it in the specified absolute position. Fields added using this method will remain visible after the lids get closed.

As you can see, EyelidFieldManager extends from AbsoluteFieldManager and this is what makes this class so problematic, as fields added in between the lids must be layed out using absolute coordinates.

In turn, AbsoluteFieldManager extends Manager so it has an additional add(Field f) method, which is overriden to add the field to the bottom eyelid. This is what is happening in your case. You should instead use the third add method listed above and provide absolute coordinates.

Upvotes: 1

Related Questions