Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Amurzet on December 13, 2023, 02:09:24 am

Title: Rules for adding manual code
Post by: Amurzet on December 13, 2023, 02:09:24 am
Sorry if this question has already been covered many times.

Are there rules for adding (concrete places) your own code to automatically generated sources?
It seems to be most obviosly method: to any place, without violating the boundaries of special tags in the comments.

However, I believe that there is a better way.

Thank you.
Title: Re: Rules for adding manual code
Post by: stahta01 on December 13, 2023, 02:31:18 am
If it is wxSmith related generated code, then the answer is yes.
You should not add the code inside the comment like start and end of each code section.

Edit2: The reason is that the stuff added inside the code section will be over written
when the wxSmith code is re-generated.

Tim S.
Title: Re: Rules for adding manual code
Post by: tigerbeard on December 14, 2023, 10:53:12 am
Edit2: The reason is that the stuff added inside the code section will be over written
when the wxSmith code is re-generated.

Its not really the OPs question, but may be worth to mention that it can be very useful to not add but delete code from withing the wxSmith boundaries. Imho its the only way to get rid of unused control callbacks.

Also I use the auto-generation of wxSmith code to easily convert XRC based dialogs to wxSmith dialogs by just creating an empty wxSmith dialog, manually converting the XRC XML file to an wxSmith WXS XML file (very simple) and manually add it to the CBP wxSmith section. Then wxSmith will autmatically generate the code and the dialog shows up in the wxSmith editor.