开发者

How to use a button in a VerticalFieldManager to change parent screen?

I have a button in the a VerticalFieldManager. If a user clicks on it, I want to wipe out the screen and load up a new VerticalFieldManager.

Currently in the homepage, I c开发者_如何学编程all a custom manager that returns a VerticalFieldManager. Because the code that builds the VerticalFieldManager is not on the homepage and does not extend Mainscreen, it doesn't have access to the screen methods.

How can I go about fixing this issue?


If I'm understanding you correctly your screen has a manager and the manager has a button that you want to modify the screen. You could do something like this:

ButtonField button = new ButtonField("Button");
button.setChangeListener(new FieldChangeListener(){
       public void fieldChanged(Field field, int context)
       {
            //The manager of this field should be the verticalFieldManager
            //and the manager of that should be the screen.
            Manager screen = field.getManager().getManager(); 
            screen.deleteAll();
            //Now create a new VerticalFieldManager and add whatever you want to it
       }

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜