ProJucer Erasing Code in MiscUserCode Section


#1

I recently compiled the Projucer from the develop branch and after opening a project via the newly built Projucer and clicked “save project,” it proceeded to delete all the code in my the MiscUserSection. Luckily I always use git, so nothing is lost, but I’m not sure why this is happening. I’ve used the “save project” option many times before and this didn’t happen.


#2

Rolled back from the develop branch to the master branch, recompiled Projucer for version 5.3.2, and using the Save Project button is still removing my MiscUserCode. Am I doing something incorrectly or is there some option to keep that code section from being deleted?


#3

Another strange development. So I failed to mention that the deletion of code wasn’t the only thing happening to my code when using the Save Project button, the Projucer was also injecting new code into my project, but these were things that you’d expect when using a new version of the Projucer, just changes to the code that injects code into your session, so some of the formatting of the auto generated code changed and such, no big deal. That was happening in addition to the deletion of the misc code. So I only committed the changes that made sense and didn’t commit the code deletion. I assumed now that if I used the Save Project button, it would continue to delete that code now, but now it is not deleting my code.

its as if it only happens when it was also injecting the new code into my session, but it doesn’t happen since I kept those changes. Strange.

Edit: Scratch all of this, it is still deleting my code, but apparently the code deletion is random and doesn’t happen every save, so I thought it was gone.


#4

It’s been suggested many times to discontinue using the ProJucer component editor thing for laying out your GUI. Only files created with that tool have that MiscUserCode section added to their source files. You might consider switching to using FlexBox or Grid to lay out your components instead of having them in a fixed position.


#5

I’ve found the error. The formatting in the tag was incorrect, so the ProJucer kept erasing the code. I have no idea how it was changed, must’ve been an accidental insertion on my end, although I always review my git diff extensively before committing… must’ve just slipped past my eyes.

And I still find it unfortunate that using the GUI editor is considered outdated. It’s very useful to me and to my other dev friends using JUCE. Some of us just simply don’t agree that creating GUIs strictly with code is the the best way. Of course there are elements I hand-code in alongside using the UI editor, but I wouldn’t want strictly hand-code it all. I sometimes start to think maybe it’s just laziness on my own part, then I remember that other environments still have extensive visual UI designers, such as Xcode and QT. I suppose I’ll keep using the GUI editor until it’s so outdated and crusty that it no longer works.

I will however look into the alternatives because those GUI element classes offer dynamic functionality that would be cool to understand and play with.


#6

I used to think the same thing but would never consider going back to a GUI editor now rather than hand-coding using FlexBox. I guess if you’ve only got a single deployment target then the arguments may not be quite as valid, but if you’re targetting desktop, tablet, phone etc it will save so much time.


#7

Absolutely. I get that entirely, that the editor is not as powerful as those classes and coding by hand, but that only makes me wish that there were dynamic elements within the GUI editor, like in Xcode and QT. I’ll still check into it though.