To open a dialog, you need contextual information—specifically, to determine in which window the dialog should be displayed. This is done using the LayoutComponent API method `getDialogSupport`. Only the ` WindowComponent ` and the `MainLayout ` set the ` dialogSupport ` directly. Otherwise, the component hierarchy is traversed until the first parent with a ` dialogSupport ` is found.
As part of Ticket #24085, this was changed so that the MainLayout of the corresponding component is queried directly for its `dialogSupport`. This is incorrect, since external windows, in particular, generally require the `dialogSupport` of the `WindowComponent`.
Specifically, this causes the dialog for selecting a script for the ScriptingRecorder to be displayed in the main window instead of in the ScriptingRecorder’s window.
Implementation
LayoutComponent receives the variable _window, which contains the enclosing WindowComponent or, in this case, the MainLayout. When a component’s parent is set, _window is also updated using the new parent.
Test
Launch the TL Demo, open the ScriptingRecorder, and open the dialog to load a script. This dialog should appear in the ScriptingRecorder window and not in the main window.