Update Form Designer - Generate general code to show the window
@@ -2393,17 +2393,27 @@ class FormDesignerCodeGenerator
func Generate oDesigner,cFormFileName
cSourceFileName = substr(cFormFileName,"rform","rform.ring")
+ cClassName = GetFileNameOnlyWithoutPath(substr(cFormFileName,".rform","")) + "View"
# Add the File Header
cOutput = "# Form/Window - Generated Source Code File " + nl +
"# Generated by the Ring "+version()+" Form Designer" + nl +
"# Date : " + date() + nl +
"# Time : " + time() + nl + nl
+ # Write general code to show the window
+ cOutput += 'Load "stdlib.ring"' + nl +
+ 'Load "guilib.ring"' + nl + nl +
+ "if IsMainSourceFile() { " + nl +
+ char(9) + "new qApp {" + nl +
+ char(9) + char(9) + "new " + cClassName + nl +
+ char(9) + char(9) + "exec()" + nl +
+ char(9) + "}" + nl +
+ "}" + nl
# Write the Class
- cClassName = GetFileNameOnlyWithoutPath(substr(cFormFileName,".rform",""))
- cOutput += "class " + cClassName + "View from WindowsViewParent" + nl
- cOutput += char(9) + "win = new qWidget() { " + nl
- cOutput += GenerateObjectsCode(oDesigner)
- cOutput += char(9) + "}" + nl + nl
+ cOutput += "class " + cClassName + " from WindowsViewParent" + nl +
+ char(9) + "win = new qWidget() { " + nl +
+ GenerateObjectsCode(oDesigner) +
+ char(9) + char(9) + "show()" + nl +
+ char(9) + "}" + nl + nl
# Add the End of file
cOutput += "# End of the Generated Source Code File..."
write(cSourceFileName,cOutput)
