More than 1 form with a menu? CreateMenu conflict - always 0

Just starting out? Need help? Post your questions and find answers here.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

More than 1 form with a menu? CreateMenu conflict - always 0

Post by Keya »

Is it possible to have more than 1 form with a menu, and still be able to edit the forms? i can't find a way :(

The problem is when you create a second form which also has its own menu, the code generated for CreateMenu always sets to 0 the menu (it doesnt ever seem to use #PB_ANY)
So, both forms have CreateMenu(0).
They both also share the same "Enumeration FormMenu", seems to be a conflict there too?

So when you load the 2nd form it also calls CreateMenu(0) and ends up corrupting the menu in the 1st form.

If you manually change it to say CreateMenu(2) and switch from Code View to Design View and then back to Code View it reverts back to CreateMenu(0).
But manually changing PBF forms is obviously not recommended, plus I need the ability to re-edit them in future, and you seemingly can't re-edit it without it reverting to CreateMenu(0).

Hopefully im just missing something simple and obvious! Helllp please! :)
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: More than 1 form with a menu? CreateMenu conflict - alwa

Post by Keya »

Nobody with any thoughts on this? I really need to create more than one dialog with a menu! :(
User avatar
mhs
Enthusiast
Enthusiast
Posts: 101
Joined: Thu Jul 02, 2015 4:53 pm
Location: Germany
Contact:

Re: More than 1 form with a menu? CreateMenu conflict - alwa

Post by mhs »

I think that's a limitation of the visual designer at the moment... :(

two possibilities:

1. Edit the form, switch to the code layout and change the number of the menu before you save the form.
2. Create the second, third, ... menu outside of the visual designer
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: More than 1 form with a menu? CreateMenu conflict - alwa

Post by netmaestro »

The form designer shows some promise but needs more development before it's a drop-in turnkey solution. In its current form the code it produces will occasionally need tweaked, as in this case. If you're new to coding in Purebasic I'd recommend not using it because it's a crutch that tries to insulate you from having to understand the code logic and it'll hold you back.
BERESHEIT
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: More than 1 form with a menu? CreateMenu conflict - alwa

Post by skywalk »

As netmaestro says, use the Form Designer to "story board" your gui and cut and paste the x-y positions and various gadget calls to your programmed gui. Eventually you will use it less and less as you concentrate on relevant events and the algorithmic processing which underlies your app.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply