News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

How do I get rid of unwanted code?

Started by Landslyde, July 06, 2018, 08:58:51 PM

Previous topic - Next topic

Landslyde

I keep deleting this in main.cpp:
Connect(ID_TREEBOOK1,wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&Angela001Frame::OnTreebook1PageChanged);

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
Connect(ID_TREEBOOK1,wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&Angela001Frame::OnTreebook1PageChanged);
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

#2
It's a *.cpp project

QuoteDo not modify the code in the wxSmith tags.... The code generator will add it again and again..

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...


QuoteThere isn't a way to remove the reference to the unwanted code?
+
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

#4
QuoteDo you know how to add events in the wxSmith editor? it is the "{}" symbol...

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.

BlueHazzard

Ok, lets clear things up, i think you have some confusion going on here....

QuoteI do. But I think I got rid of it when I deleted the lines from the .cpp and .h
No, all editor related things are stored in a xml file, that is only edited by the wxSmith plugin (the drawing thing in codeblocks you use to create the dialog)

Quotethe two .save files for main.cpp and main.h.
They are not used by codeblocks normally, only used if something went wrong. So do yourself a favor and DO NOT EDIT OR DELETE them...

Quoteclosed CB and opened it back up. So far, that code's staying away. Fingers crossed here!
Ok, i thought that wxSmith loads it automatically. You will see as soon as you open wxSmith, edit something and save it will come back...

I absolutely do not understand where the problem is to remove the event handler within the wxSmith editor. Why people always have to workaround to problems that are not there. Use buggy solutions and think it will work.

QuoteSay, I'm using the wxTreebook. It works good for putting a lot on one form. But is there anything like a stacked widget for CB? It's abt the same as the wxTreebook...just doesn't have the tree.
Ok, now you talk about complete different?
QuoteBut is there anything like a stacked widget for CB
codeblocks does not have anything of this... WxWidgets has it and wxSmith (a codeblocks plugin) probably has to support it.
I do not know what a stacked widget is. WxWidgets supports mostly only native window elements. So if your operating system supports it wxWidgets will have it. One possibility to share window elements across multiple pages is a notebook control. Yes wxSmith supports it. You can add new pages with a right click in the editor.
We do not support wxWidgets questions here... But if you have some problems creating some constellation of windows with wxSmith you can ask here...





BlueHazzard

I think what you are searching for is a "wxListBook" and yes wxSmith supports it.
You can add panels by dropping a wxPanel over the wxListBook

Landslyde

Thanks for the good information, BlueHazzard.