What I did, which I think would solve your problem without changing Pivot, is to use a subclass of Action that I can pass parameters to. Then my subclass of Action object can be instantiated right away, but actual working of the action gets the parameter from wherever the context is stored and passes that at the time the action is invoked.
I'm not explaining it very well, but my feeling is that you shouldn't really have to make a dummy action and then replace it later. Just instantiate the real action up front but have the "perform" method get the context from somewhere so it can do the right thing depending on the context (after your screen initialization is done). In our application it is kind of complicated since our actions can be invoked from several different places and the context has to be gotten in various ways depending on how the action was invoked, but it is all very doable without having to change the Action objects once they are passed to the NamedActions dictionary. HTH, but let us know if you still need help and I can try to explain things better. Or perhaps you could post a little more detail on what you need to achieve. Bottom line: I don't think you should have to replace any Action objects to do what you need to do. ~Roger Whitcomb -----Original Message----- From: ccp999 [mailto:[email protected]] Sent: Wednesday, July 04, 2012 11:43 PM To: [email protected] Subject: Action.getNamedActions() cannot be updated with an new action Hi, I followed tutorial example to setup a menu bars. I put dummy action in the constructor because I need to set a parameter after the initialization of the screen objects. I set a function to replace the dummy action as: Action.getNamedActions().put("xxx", new action (){ xxx }); but the put function doesn't replace the dummy action, even I insert: Action.getNamedActions().remove("xxx"); it doesn't help. Did I miss anything? or it is a bug. -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Action-getNamedActions-ca nnot-be-updated-with-an-new-action-tp4021939.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
