The menu SHOULD look like this, where "---" is a Separator/Bar menu item:
Code: Select all
Parent1
---
Parent2
P2 Child1
P2 Child2
---
Parent3
But when you press F5 to Compile/Run it, instead it is appearing as:
Code: Select all
Parent1
---
Parent2
P2 Child1
P2 Child2
---
Parent3
The reason is obvious when you look at the code (simply "MenuBar()" is wrongly being put before "CloseSubMenu()" instead of after it in this case)
But there's nothing I can do about it because even if I change the order of the code, when I press F5 it recompiles the form, reintroducing the bug
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Global Window_2
Enumeration FormMenu
#Menu_Parent1
#Menu_P2Child1
#Menu_P2Child2
#Menu_Parent3
EndEnumeration
Procedure OpenWindow_2(x = 0, y = 0, width = 600, height = 400)
Window_2 = OpenWindow(#PB_Any, x, y, width, height, "Menu test", #PB_Window_SystemMenu)
CreateMenu(0, WindowID(Window_2))
MenuTitle("File")
MenuItem(#Menu_Parent1, "Parent1")
MenuBar()
OpenSubMenu("Parent2")
MenuItem(#Menu_P2Child1, "P2 Child1")
MenuItem(#Menu_P2Child2, "P2 Child2")
MenuBar() ;<--\------------------------------------- THIS SHOULD BE _AFTER_ THE NEXT LINE ("CLOSESUBMENU()")
CloseSubMenu() ;<--/
MenuItem(#Menu_Parent3, "Parent3")
EndProcedure
Procedure Window_2_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #Menu_Parent1
Case #Menu_P2Child1
Case #Menu_P2Child2
Case #Menu_Parent3
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedureIve retried it several times, starting from scratch etc, but i'm unable to escape this bug. I guess it'd be ok if the compiler didn't recompile the PBF form after I manually adjusted the line to correct it, but it seems intent on recompiling it so i cant make any changes to it (but I do understand the compiler essentially demands full control over PBF files)
For a temporary workaround is my best option to rename the PBF to PB so i can include the bugfix (line reorder), and only renaming back to PBF when i need to make visual changes, and then when i switch back to PB re-make the bugfix?
ps. can we please have a keyboard shortcut for Switch Design/Code View? its so annoying having to find and click menu with my mouse each time! thankyou
I know there is Alt+V in Tools menu to go to Form Designer, but all that does is open the Form tab in the Code Edit view, it doesnt actually open the Form Designer, nor does it allow switching between the two
