Author Topic: Code::blocks keeps changing my code  (Read 3233 times)

Offline lethjakman

  • Single posting newcomer
  • *
  • Posts: 3
Code::blocks keeps changing my code
« on: July 14, 2010, 04:30:09 am »
Every time I exit my code, code::blocks  my code is different, and as a result broken. A lot of this code I have never seen before, but I know darn good and well that I use Connect() rather than event tables. How do I make this stop? I don't want code::blocks changing what I wrote, I wrote it the way I wrote it because I want it that way. Thank you!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: Code::blocks keeps changing my code
« Reply #1 on: July 14, 2010, 07:08:58 am »
Every time I exit my code, code::blocks  my code is different, and as a result broken. A lot of this code I have never seen before, but I know darn good and well that I use Connect() rather than event tables. How do I make this stop? I don't want code::blocks changing what I wrote, I wrote it the way I wrote it because I want it that way. Thank you!
As you give no more details I assume you are using wxSmith. Well - a GUI builder works in that way: It has special "tagged" regions in your source file that will be filled by wxSmith. You should not change code inside these regions as it will get overwritten. If you don't want that, you can specialise the functionality yourself by e.g. not using wxSmith to connect the events but your own implementation. Just make sure you are outside the wxSmith regions (they start with //(* and end with //*)).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline lethjakman

  • Single posting newcomer
  • *
  • Posts: 3
Re: Code::blocks keeps changing my code
« Reply #2 on: July 14, 2010, 07:57:05 am »
Hey! Thank you for the response. I'm not sure how to give details since my code has been rewritten. My code is written by hand, no GUI builder. The best way I can describe it is it removes all my Connect()'s and add's this.
Code
BEGIN_EVENT_TABLE(PastriesDialog, wxDialog)
    EVT_CLOSE(PastriesDialog::OnClose)
    EVT_BUTTON(idBtnQuit, PastriesDialog::OnQuit)
    EVT_BUTTON(idBtnAbout, PastriesDialog::OnAbout)
END_EVENT_TABLE()

Plus a lot of other stuff at the top like

Code
//helper functions
enum wxbuildinfoformat {
    short_f, long_f };

wxString wxbuildinfo(wxbuildinfoformat format)
{
    wxString wxbuild(wxVERSION_STRING);

    if (format == long_f )
    {
#if defined(__WXMSW__)
        wxbuild << _T("-Windows");
#elif defined(__WXMAC__)
        wxbuild << _T("-Mac");
#elif defined(__UNIX__)
        wxbuild << _T("-Linux");
#endif

#if wxUSE_UNICODE
        wxbuild << _T("-Unicode build");
#else
        wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
    }

    return wxbuild;
}



I apologise for not including examples at the beginning, I'm kinda confused as to how to explain it. Really a lot of my code isn't recognizable anymore.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Code::blocks keeps changing my code
« Reply #3 on: July 14, 2010, 09:54:40 am »
The code you provide looks exactly like the code produced by C::B's wizard through "File -> New -> Project... -> wxWidgets project" if you call it "Pastries" and chose "Dialog" as type (I just tried this).

Are you sure you reopen the saved project and do not use the wizard ?

Are you sure your changes are saved ? Look at the timestamps of the files and see if there are files with the ending "cbtemp" .