Author Topic: Rules for adding manual code  (Read 1184 times)

Offline Amurzet

  • Single posting newcomer
  • *
  • Posts: 1
Rules for adding manual code
« 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Rules for adding manual code
« Reply #1 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.
« Last Edit: December 13, 2023, 03:03:44 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 190
Re: Rules for adding manual code
« Reply #2 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.