Page 1 of 1

FD5b3 crashes when loading old VD4 files (FD5b2 does not)

Posted: Thu Dec 13, 2012 11:01 am
by Niffo
When trying to load old "visual Designer 4" generated files, "Form Designer 5 beta 2" does it nice (!), but "Form Designer 5 beta 3" crashes.

VD4 sample file who causes the crash :

Code: Select all

Enumeration
  #Frm_Main
  #Frm_Properties
  #Frm_About
EndEnumeration

Enumeration
  #Chk_NoBorder
  #Txt_YPosition
  #Txt_XPosition
  #Chk_ForcePosition
  #Lbl_YPosition
  #Lbl_XPosition
  #Chk_TopMost
  #Opt_Windowed
  #Opt_Screen
  #Lbl_Screen
  #Cmd_PropertiesValide
  #Chk_Centered
  #Cbo_VideoOutput
  #Fra_OutputSize
  #Chk_KeepAspectRatio
  #Fra_VideoOutput
  #Txt_OutputHeight
  #Lbl_OutputHeight
  #Lbl_OutputWidth
  #Txt_OutputWidth
  #Opt_Size_0
  #Opt_Size_1
  #Opt_Size_2
  #Fra_Misc
  #Cmd_CloseAbout
  #Img_About
  #Lbl_About
EndEnumeration

;- Images
Global Image0 = CatchImage(#PB_Any, ?Image0)

DataSection
Image0:
  IncludeBinary "GFX/about.png"
EndDataSection

;- Fonts
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
  Global FontID1 = LoadFont(1, "Arial Unicode MS", 21)
CompilerElse
  Global FontID1 = LoadFont(1, "Arial", 18)
CompilerEndIf


Procedure Open_Frm_Properties()
  If OpenWindow(#Frm_Properties, 220, 36, 520, 289, "Frm_Properties",  #PB_Window_SystemMenu | #PB_Window_Invisible | #PB_Window_TitleBar , WindowID(#Frm_Main))
    ;If CreateGadgetList(WindowID(#Frm_Properties))
    Frame3DGadget(#Fra_OutputSize, 240, 10, 270, 150, "Fra_OutputSize")
    OptionGadget(#Opt_Size_0, 250, 30, 160, 20, "Opt_OriginalSize")
    OptionGadget(#Opt_Size_1, 250, 50, 160, 20, "Opt_FullSize")
    OptionGadget(#Opt_Size_2, 250, 70, 160, 20, "Opt_FixedSize")
    TextGadget(#Lbl_OutputWidth, 270, 100, 170, 20, "Lbl_OutputWidth", #PB_Text_Right)
    StringGadget(#Txt_OutputWidth, 450, 100, 50, 20, "")
    TextGadget(#Lbl_OutputHeight, 270, 120, 170, 20, "Lbl_OutputHeight", #PB_Text_Right)
    StringGadget(#Txt_OutputHeight, 450, 120, 50, 20, "")
    Frame3DGadget(#Fra_Misc, 240, 170, 270, 70, "Fra_Misc")
    CheckBoxGadget(#Chk_KeepAspectRatio, 250, 190, 250, 20, "Chk_KeepAspectRatio")
    CheckBoxGadget(#Chk_Centered, 250, 210, 250, 20, "Chk_Centered")
    Frame3DGadget(#Fra_VideoOutput, 10, 10, 220, 230, "Fra_VideoOutput")
    OptionGadget(#Opt_Windowed, 20, 30, 200, 20, "Opt_Windowed")
    OptionGadget(#Opt_Screen, 20, 170, 200, 20, "Opt_Screen")
    CheckBoxGadget(#Chk_NoBorder, 60, 50, 160, 20, "Chk_NoBorder")
    CheckBoxGadget(#Chk_TopMost, 60, 70, 160, 20, "Chk_TopMost")
    CheckBoxGadget(#Chk_ForcePosition, 60, 90, 160, 20, "Chk_ForcePosition")
    TextGadget(#Lbl_XPosition, 60, 120, 100, 20, "Lbl_XPosition", #PB_Text_Right)
    StringGadget(#Txt_XPosition, 170, 120, 50, 20, "")
    TextGadget(#Lbl_YPosition, 60, 140, 100, 20, "Lbl_YPosition", #PB_Text_Right)
    StringGadget(#Txt_YPosition, 170, 140, 50, 20, "")
    TextGadget(#Lbl_Screen, 60, 190, 160, 20, "Lbl_Screen")
    ComboBoxGadget(#Cbo_VideoOutput, 60, 210, 160, 20)
    ButtonGadget(#Cmd_PropertiesValide, 210, 260, 110, 20, "Cmd_Valide")
    ;EndIf
  EndIf
EndProcedure

Procedure Open_Frm_About()
  If OpenWindow(#Frm_About, 234, 376, 485, 114, "Frm_About",  #PB_Window_SystemMenu | #PB_Window_Invisible | #PB_Window_TitleBar | #PB_Window_WindowCentered , WindowID(#Frm_Main))
    ;If CreateGadgetList(WindowID(#Frm_About))
    ImageGadget(#Img_About, 10, 10, 64, 64, ImageID(Image0))
    TextGadget(#Lbl_About, 90, 20, 380, 40, "App v0.0.0", #PB_Text_Center)
    SetGadgetFont(#Lbl_About, FontID1)
    ButtonGadget(#Cmd_CloseAbout, 190, 80, 110, 20, "Cmd_Close")
    
    ;EndIf
  EndIf
EndProcedure

Re: FD5b3 crashes when loading old FD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 11:18 am
by IdeasVacuum
I think it could be the 'If' before OpenWindow(), as the Form Designer does not output that.

Re: FD5b3 crashes when loading old FD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 1:38 pm
by Polo
Your file doesn't respect the FD output code structure, and has two windows in it (only one per form is allowed)

Re: FD5b3 crashes when loading old FD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 3:02 pm
by Niffo
Yes, this file is a "Visual Designer 4" file but the previous version of "Form Designer" (beta2) loads it correctly and creates multiple forms. This was an ideal method to converts VD4 files to FD5 files and i thought it was intentionally done.
This regression is sad :'( Is it possible to still download FD5beta 2 somewhere ?

Re: FD5b3 crashes when loading old VD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 4:42 pm
by Lothar Schirm
I agree with Niffo that it would be nice to save several forms into one file. The old Visual Designer did that, and PureForm does that, too. With Form Designer 5.00 beta 3 you have one pbf file and optionally one event file for each form. As an example, for a small project with 3 forms you have:
- one main file
- 3 pbf files
- 3 event files
- possibly one or two other include files
- one project file
----------------------------------------
total: 9 or 10 files

That's a lot! And as Niffo describes, you must split up your code into code for single windows if you want to modify old code with the Form Designer.

Re: FD5b3 crashes when loading old VD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 5:05 pm
by Fred
It's may be a lot, but it also helps in maintenance. Just take a look to C# for example, it does exactly the same. If you want to migrate, just create one file per form, you don't need to use an event file per file, you can put everything in the main file.

Re: FD5b3 crashes when loading old VD4 files (FD5b2 does not

Posted: Thu Dec 13, 2012 5:23 pm
by Niffo
Having several forms into one file is absolutely not my need ! My need is only FD5 beta 2 works at least as well as FD5 beta 3 and do not crash in same conditions :D

Re: FD5b3 crashes when loading old VD4 files (FD5b2 does not

Posted: Fri Dec 14, 2012 3:10 pm
by Polo
Niffo wrote:Having several forms into one file is absolutely not my need ! My need is only FD5 beta 2 works at least as well as FD5 beta 3 and do not crash in same conditions :D
The file isn't valid and should not be loaded, but you're right it shouldn't crash though, I'll fix that ;)