Visual Designer SubMenu Code Generation Bug

Post bugs related to the IDE here
OgreVorbis
User
User
Posts: 77
Joined: Thu Jan 16, 2020 10:47 pm

Visual Designer SubMenu Code Generation Bug

Post by OgreVorbis »

Someone I'm helping learn PB has discovered what seems like a pretty serious bug in the visual designer when making sub-menus. I searched and I could not turn up anything. Maybe we are both just overlooking something in the designer?

We are using PB 5.73. Maybe it's fixed in the beta?

Here's what happens: Make a window and add a menubar. Make some menu items, then make two items that contain sub menus. Make a few sub menu items for each of them. Make sure those two sub menu "branches" are right next to each other in the menu. Now generate the code and run the window. You will see that PB messed up the menus and put all the items from the second menu inside the first.

The bug becomes clear when looking at the generated code. It places the CloseSubMenu() (s) at the bottom of the menu creation code instead of between every sub menu. I have to forcefully modify the code, but each time the window changes, it goes back to the bugged way.

Example:
Here's the incorrect generated PB code:

Code: Select all

  CreateMenu(0, WindowID(Window_Main))
  MenuTitle("Test")
  MenuItem(#MenuItem_2, "Test 2")
  OpenSubMenu("Test 3")
  MenuItem(#MenuItem_4, "Sub Item")
  MenuItem(#MenuItem_5, "Sub Item 2")
  OpenSubMenu("Test 4")
  MenuItem(#MenuItem_7, "Another Sub")
  MenuItem(#MenuItem_8, "Another Sub 2")
  MenuBar()
  CloseSubMenu() ; <--- WRONG LOCATION
  MenuItem(#MenuItem_Exit, "Exit")
  CloseSubMenu() ; <----------
Here's the correct code:

Code: Select all

  CreateMenu(0, WindowID(Window_Main))
  MenuTitle("Test")
  MenuItem(#MenuItem_2, "Test 2")
  OpenSubMenu("Test 3")
  MenuItem(#MenuItem_4, "Sub Item")
  MenuItem(#MenuItem_5, "Sub Item 2")
  CloseSubMenu() ; <--- CORRECT
  OpenSubMenu("Test 4")
  MenuItem(#MenuItem_7, "Another Sub")
  MenuItem(#MenuItem_8, "Another Sub 2")
  CloseSubMenu() ; <----------
  MenuBar()
  MenuItem(#MenuItem_Exit, "Exit")
My blog/software site: http://dosaidsoft.com/