User forums > Using Code::Blocks

How do I get rid of unwanted code?

(1/2) > >>

Landslyde:
I keep deleting this in main.cpp:

--- Code: ---Connect(ID_TREEBOOK1,wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&Angela001Frame::OnTreebook1PageChanged);
--- End code ---

I removed the code for this in main.h too. BUT, everytime I do anything to the form, the code I deleted in main.cpp comes back! I've deleted

--- Code: ---Connect(ID_TREEBOOK1,wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&Angela001Frame::OnTreebook1PageChanged);
--- End code ---
more than twenty times. What do I need to do to permanently delete this? In Qt I've have to delete it from the .moc file. But I can't find anything like that here.

BlueHazzard:
Do not modify the code in the wxSmith tags.... The code generator will add it again and again..

Have you removed the event in the wxSmith editor?
What kind of project are you using? XRC or cpp?

Landslyde:
It's a *.cpp project


--- Quote ---Do not modify the code in the wxSmith tags.... The code generator will add it again and again..
--- End quote ---

I didn't know this. There isn't a way to remove the reference to the unwanted code? I guess it doesn't hurt anything being there, but it sure don't look right.

Anyway, I did delete both the main.cpp.save and main.h.save files and the code hasn't came back since I made this post. If it comes back, I'll open a new project and c/p my code into it. Something about lingering code that just don't set right with me.

Thanks for your help, BlueHazzard.

BlueHazzard:
It will come again as soon as you modify in the wxSmith editor or load the project...



--- Quote --- There isn't a way to remove the reference to the unwanted code?
--- End quote ---
+
YES... remove it in the wxSmith editor.
You have to have added an event for the ID_TREEBOOK1 at one point...
Do you know how to add events in the wxSmith editor? it is the "{}" symbol...



There is a other way to remove this, but i do not want to share it if there is a other way to do it... If you can not find it at any circumstance : ask and i will tell you, but as far as i can tell it will create more problems than it solves (the most time)...

Landslyde:

--- Quote ---Do you know how to add events in the wxSmith editor? it is the "{}" symbol...
--- End quote ---

I do. But I think I got rid of it when I deleted the lines from the .cpp and .h and then deleted the two .save files for main.cpp and main.h. I've jacked around with the form, closed CB and opened it back up. So far, that code's staying away. Fingers crossed here!

What made me decide to delete the two .save files was the fact that when I'd delete the wx line of code that kept coming back, I was also changing my form size in the properties from 791 width to 825. And that also reflected in the wx code. But then when the deleted wx code wld come back, my form width was back to 791 again. That's why I'm sure deleting those two .save files did the trick.

Navigation

[0] Message Index

[#] Next page

Go to full version