I'm working on a script that includes a "Settings Window". This settings window contains a tabbed panel.
When I launch the "Settings Window" from the docked panel for the first time, the tabbed panel appears and works as desired.
If the window is then closed using the red X in the window native UI, the next time I launch the settings window from the docked panel, the tabbed panel no longer appears and I encounter errors.
I also have buttons (Save/Cancel/Run) included in the window UI that hide the "Settings Window" - when one of these buttons are used (instead of the native UI close button), the Settings window can be re-launched and the tabbed panel is still in tact. I changed the "panels" to groups just to confirm that this was indeed the issue and sure enough, the groups were still present on relaunch.
Anyone encounter this issue before? I can't figure out a way around, aside from dropping the tabbed panel.
I tried to intercept the onClose event, so I could use .hide() instead of .close(), but I'm unable to stop that event of closing the window with stopPropegation or preventDefault.
Code:
//Create Main Settings Window mainSettingsDlgGroup = "palette {size:[450,500],preferredSize:[450,500],\ tabButtonGroup: Group{orientation:'stack',alignChildren:['left','top'],alignment:['left','top'],preferredSize:[450,-1]\ updatingButtons: Group{orientation:'row',alignChildren:['left','top'],alignment:['fill','top'],preferredSize:[425,-1],margins:[20,20,20,20],\ cancelButton: Button{text:'Cancel'},alignment:['left','top'],\ saveButton: Button{text:'Save'},alignment:['left','top'],\ saveRunButton: Button{text:'Save & Run'},alignment:['left','top'],\ },\ },\ tabGroup: Group{orientation:'row',alignChildren:['left','top'],alignment:['fill','top'],margins:[10,5,0,0],\ tabbedPanel: Panel{type:'tabbedpanel',margins:[20,20,20,20],\ panelOne: Panel{type:'tab',text:'Panel One', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\ checkboxOne: Checkbox{text:'option one'},\ checkboxTwo: Checkbox{text:'option two'},\ },\ panelTwo: Panel{type:'tab',text:'Panel Two', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\ checkboxOne: Checkbox{text:'option one'},\ checkboxTwo: Checkbox{text:'option two'},\ },\ panelThree: Panel{type:'tab',text:'Panel Three', orientation:'column',alignChildren:['left', 'top'],margins:[20,20,20,20],\ checkboxOne: Checkbox{text:'option one'},\ checkboxTwo: Checkbox{text:'option two'},\ },\ },\ },\ }" settingsWin = new Window( mainSettingsDlgGroup ); var tabbedPanel = settingsWin.tabGroup.TabbedPanel; //Close Function function closeSettings() { settingsWin.hide(); } //Open Function function openSettings() { try{ if(tabbedPanel == null) { alert('tabbedPanel is null'); // Alert does not run, is not return NULL } settingsWin.center(); settingsWin.show(); //tabbedPanel.show(); // commented out as it does not seem to have any effect (also I'm never hiding the tabbedPanel) //tabbedPanel.maximumSize = [1000,1000]; settingsWin.layout.layout(true); //updateUILayout(settingsWin); //commented out as it does not work and throws and error on re-launch tabbedPanel.selection = tabbedPanel.children[0]; } catch(err){alert('error from openSettings ' + err.line + '\n' + err.message);} }
The Try/Catch throws the following error (on relaunch AFTER AE UI close red X is used):
"Window layout failed
-Group layout failed
-Panel layout failed
-cannot get value of maximumSize property for tab: "