public void onOK() { GuiTextEditCtrl nameField = this.FOT("nameField"); GuiPopUpMenuCtrl classDropdown = this.FOT("classDropdown"); editor Editor = "Editor"; string name = nameField.getValue(); string className = classDropdown.getText(); // Make sure we don't clash with an existing object. // If there's an existing GUIControl with the name, ask to replace. // If there's an existing non-GUIControl with the name, or the name is invalid, refuse to create. if (name.isObject() && ((SimObject)name).isMemberOfClass("GuiControl")) { if ( Util.messageBox("Warning", "Replace the existing control '" + name + "'?", "OkCancel", "Question") == iGlobal["$MROk"]) { name.delete(); } else { return; } } if (Editor.validateObjectName(name, false)) { ((GuiCanvas)this.getRoot()).popDialog(this); SimObject obj = Util.eval("return new " + className + "(" + name + ");"); // Make sure we have no association with a filename. obj.setFilename(""); GuiEditorGui.GuiEditContent(obj); } }