I realized that calling
getTopLevelComponent() in the constructor of the MainComponent returns null although it should return the DocumentWindow that is owning the MainComponent. I want to call
getTopLevelComponent()->isAlwaysOnTop() for a ToggleButton’s state in the constructor but that doesn’t work. I can, however, call that function from
resized() without any problems. Any hints how to do that in a correct way?
I used an AsyncUpdater in the meantime but that doesn’t seem to be an elegant way and also I would like to understand why I cannot call
getTopLevelComponent() from within the constructor.