I want to add popup at certain location. Say at the bottom of the view.
So I set the 4th parameter to false ( not centered)
PopUpManager.addPopUp( panel_Pan, gameView_Gv, true, false );
But it’s still showing at center.
And there does not seem to be any other way to define the location in terms of x and y. Or relative.
To manually position panel_Pan
, you can set its x
and y
properties, just like you would position any display object.
PopUpManager.addPopUp( panel_Pan, gameView_Gv, true, false );
panel_Pan.x = 20.0;
panel_Pan.y = 10.0;
2 Likes
Yes. I had guessed that. But it did not work.
I will try again.
And what is the way to get panel width and height? When I use panel_Pan.height it always returns “0” . I also tried panel_Pan.backgroundSkin.height. And panel_Pan.actualHeight
All are zero.
PopUpManager.addPopUp(panel_Pan, gameView_Gv,
true, //modal
false //centered
);
panel_Pan.y = gameView_Gv.stage.stageHeight- panel_Pan.height ;
Also is their any way I can make Alert grey background behind to disable the view more transparent and different color?
You need to call validateNow()
before getting the width or height of a component. Feathers UI components queue up their changes (invalidation) and apply them all at once when they are about to render (validation). This brings a big performance improvement. However, if you need to access something that doesn’t get calculated until the validation process, you can force validation to happen immediately with validateNow()
.
PopUpManager.addPopUp(panel_Pan, gameView_Gv,
true, //modal
false //centered
);
panel_pan.validateNow(); // width/height may be missing until validation
panel_Pan.y = gameView_Gv.stage.stageHeight- panel_Pan.height ;
PopUpManager.addPopUp()
has an optional customOverlayFactory
parameter that may be used to customize the “grey background”.