Bug: Form Designer does not read .pbf files correctly
Posted: Mon Nov 26, 2012 6:00 pm
Form Designer 5.00 beta 3 shipped with PureBasic 5.00 does not read .pbf files correctly in some cases:
1. If the .pbf file contains a button with caption "=" (e.g. in a program for a calculator where this button shall be used to display the result), the code is incorrect, see below.
2. If the .pbf file contains an editor gadget with text including commas, the text is not shown completely.
I have summarized the two errors in a short file Test.pbf. The file has been created correctly using the Form Designer. Code:
When this file is opened again by the Form Designer, the Form Designer creates the following code view:
If you change from the Code View to the Design View - Button_0 Property Window, you see that the checkbox "PB Any" is marked. (When creating the .pbf file, it was not marked.) The variable name of Button_0 has changed to ButtonGadget(#Button_0, 40, 30, 40, 20, ". 
1. If the .pbf file contains a button with caption "=" (e.g. in a program for a calculator where this button shall be used to display the result), the code is incorrect, see below.
2. If the .pbf file contains an editor gadget with text including commas, the text is not shown completely.
I have summarized the two errors in a short file Test.pbf. The file has been created correctly using the Form Designer. Code:
Code: Select all
; Form Designer for Purebasic - 5.0
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.
Enumeration #PB_Compiler_EnumerationValue
#Window_0
EndEnumeration
Enumeration #PB_Compiler_EnumerationValue
#Button_0
#Editor_0
EndEnumeration
Procedure InitWindow_0()
OpenWindow(#Window_0, 0, 0, 600, 400, "Test.pbf", #PB_Window_SystemMenu)
ButtonGadget(#Button_0, 40, 30, 40, 20, "=")
EditorGadget(#Editor_0, 30, 90, 480, 130)
AddGadgetItem(#Editor_0, -1, "This text line will be shown correctly if Test.pbf is opend by the Form Designer again - ")
AddGadgetItem(#Editor_0, -1, "this text line, however, not because it contains comma.")
EndProcedure
When this file is opened again by the Form Designer, the Form Designer creates the following code view:
Code: Select all
Global ButtonGadget(#Button_0, 40, 30, 40, 20, "
Enumeration #PB_Compiler_EnumerationValue
#Window_0
EndEnumeration
Enumeration #PB_Compiler_EnumerationValue
#Editor_0
EndEnumeration
Procedure InitWindow_0()
OpenWindow(#Window_0, 0, 0, 600, 400, "Test.pbf", #PB_Window_SystemMenu)
ButtonGadget(#Button_0, 40, 30, 40, 20, " = ButtonGadget(#PB_Any, 40, 30, 40, 20, "=")
EditorGadget(#Editor_0, 30, 90, 480, 130)
AddGadgetItem(#Editor_0, -1, "This text line will be shown correctly if Test.pbf is opend by the Form Designer again - ")
AddGadgetItem(#Editor_0, -1, "this text lin")
EndProcedure