Page 1 of 1

FormDesigner Menu Design mode issue

Posted: Tue Jan 17, 2017 3:43 am
by dougmo52usr
I used FormDesigner to create a menu. Something simple like:

MainMenu
SubMenu1
SubMenu1Item1
SubMenu1Item2
SubMenu2
SubMenu2Item1
SubMenu2Item2

When FormDesigner is building the menu, it shows it as expected in the GUI design. The code should look like:

Code: Select all

  CreateMenu(0, WindowID(Window_0))
  MenuTitle("MenuTitle")
  OpenSubMenu("SubMenu1")
  MenuItem(#MenuItem_3, "SubMenu1Item1")
  MenuItem(#MenuItem_4, "SubMenu1Item2")
  CloseSubMenu()
  OpenSubMenu("SubMenu2")
  MenuItem(#MenuItem_6, "SubMenu2Item1")
  MenuItem(#MenuItem_7, "SubMenu2Item2")
  CloseSubMenu()
But If I save the code and look at it, FormDesigner has make SubMenu2 a submenu under submenu1.

MainMenu
SubMenu1
SubMenu1Item1
SubMenu1Item2
SubMenu1SubMenu2
SubMenu2Item1
SubMenu2Item2

Code: Select all

  CreateMenu(0, WindowID(Window_0))
  MenuTitle("MenuTitle")
  OpenSubMenu("SubMenu1")
  MenuItem(#MenuItem_3, "SubMenu1Item1")
  MenuItem(#MenuItem_4, "SubMenu1Item2")
  OpenSubMenu("SubMenu2")
  MenuItem(#MenuItem_6, "SubMenu2Item1")
  MenuItem(#MenuItem_7, "SubMenu2Item2")
  CloseSubMenu()
  CloseSubMenu()
If in Code View I edit the code to put the CloseSubMenu() back in the correct place and switch to design view, the menu looks correct. But if I then switch back to Code View, the code is now incorrect. The next time I switch to Design View, the CloseSubMenu() is again in the wrong place.

I had to hand code the menus in my PB file because of the CloseSubMenu() misplacement.

Re: FormDesigner Menu Design mode issue

Posted: Tue Jan 17, 2017 3:57 am
by TI-994A
dougmo52usr wrote:...in Code View I edit the code to put the CloseSubMenu() back in the correct place and switch to design view, the menu looks correct.
The code page of the Form Designer does not accept edits. It conforms strictly to the properties of the visual objects, and generates the code accordingly. Any changes must be made in the visual window.

Re: FormDesigner Menu Design mode issue

Posted: Tue Jan 17, 2017 5:03 am
by dougmo52usr
Here's a link to what I saw in FormDesigner during the menu design:
https://www.dropbox.com/s/533vkggb5twdd ... 1.png?dl=0

Now I went from Design to Code to Design viwe and the appearance changed without editing the pbf file:
https://www.dropbox.com/s/ldaerxgszdp7h ... 2.png?dl=0

FormDesigner broke the code by relocating the CloseSubMenu() call. It changed merely be changing FormDesigner views, but if I compile and run the app, it is also incorrect.

Re: FormDesigner Menu Design mode issue

Posted: Tue Jan 17, 2017 9:08 am
by TI-994A
dougmo52usr wrote:FormDesigner broke the code by relocating the CloseSubMenu() call...
You're right; there appears to be some inconsistencies in Form Designer's menu builder.

Image

Re: FormDesigner Menu Design mode issue

Posted: Sun Jan 19, 2020 8:06 pm
by bfernhout
May i come here and say the problmen still exist. Its now version 5.72 and still this problem exist.

Re: FormDesigner Menu Design mode issue

Posted: Fri Jan 05, 2024 8:19 pm
by dougmo52usr
Running PureBasic 6.04 LTS (Linux - x64).

1. The menu issue in Form Designer still exists. If I create a menu with submenus, the design looks good when I view the form. But If I go to view code, and back to view form, it moves the OpenSubMenu()'s around and breaks things. For now, I am creating the menu in my code because Form Designer can't get it right.

2. I can type an event handler in for a menu item. but it doesn't seem to declare it, or use it in the automatically generated Window_0_Events procedure.