Page 1 of 1

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

Posted: Thu Aug 13, 2015 5:57 am
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! :)

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

Posted: Sat Aug 15, 2015 12:16 am
by Keya
Nobody with any thoughts on this? I really need to create more than one dialog with a menu! :(

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

Posted: Sat Aug 15, 2015 8:28 am
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

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

Posted: Sat Aug 15, 2015 6:52 pm
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.

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

Posted: Sat Aug 15, 2015 7:09 pm
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.