Sam, Calling getWindow() on your PushButton in the ButtonPressListener should return its parent Window (once the BXML fragment has been loaded *and* added to MyWindow)
If calling getParent() returns a null, then it suggests that you have not added the PushButton to its parent Container yet. Depending on how and where you are creating your ButtonPressListener, you might be able to just pass in a reference to MyWindow for it to use rather than looking it up at runtime via getWindow(). However, that would just be a workaround as getWindow() should work. It is hard to answer the question without being able to see your code. Is there any chance you can attach a simple example demonstrating what you are doing? It just needs to show how and where you are creating your ButtonPressListener that gets a null back from getWindow() or getParent(). Chris On 1 May 2011 18:41, sam <[email protected]> wrote: > Now the two components are loaded > correctly and I want the apply button to create some new component in the > main window (MyWindow). Somwhere the buttonPressedListener must be able to > reference the window. I tried getParent(), getWindow() and all return null. > How can I find the window within the component just dynamically created and > added to the window? > > Sam-- > View this message in context: > http://apache-pivot-users.399431.n3.nabble.com/Dynamically-adding-components-to-a-boxpane-and-ID-already-used-error-tp2885412p2886007.html > Sent from the Apache Pivot - Users mailing list archive at Nabble.com. >
